Changeset 45795
- Timestamp:
- 08/14/2019 03:35:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/listAuthors.php
r43571 r45795 76 76 77 77 function test_wp_list_authors_default() { 78 $expected['default'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 78 $expected['default'] = 79 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 80 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' . 81 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 82 79 83 $this->AssertEquals( $expected['default'], wp_list_authors( array( 'echo' => false ) ) ); 80 84 } 81 85 82 86 function test_wp_list_authors_orderby() { 83 $expected['post_count'] = '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li><li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>'; 87 $expected['post_count'] = 88 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>' . 89 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 90 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>'; 91 84 92 $this->AssertEquals( 85 93 $expected['post_count'], … … 94 102 95 103 function test_wp_list_authors_order() { 96 $expected['id'] = '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 104 $expected['id'] = 105 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' . 106 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 107 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 108 97 109 $this->AssertEquals( 98 110 $expected['id'], … … 108 120 109 121 function test_wp_list_authors_optioncount() { 110 $expected['optioncount'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (2)</li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (3)</li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (1)</li>'; 122 $expected['optioncount'] = 123 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (2)</li>' . 124 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (3)</li>' . 125 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (1)</li>'; 126 111 127 $this->AssertEquals( 112 128 $expected['optioncount'], … … 127 143 ) 128 144 ); 129 $expected['exclude_admin'] = '<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li><li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 145 146 $expected['exclude_admin'] = 147 '<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li>' . 148 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 149 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' . 150 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 151 130 152 $this->AssertEquals( 131 153 $expected['exclude_admin'], … … 140 162 141 163 function test_wp_list_authors_show_fullname() { 142 $expected['show_fullname'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob reno</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul norris</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack moon</a></li>'; 164 $expected['show_fullname'] = 165 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob reno</a></li>' . 166 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul norris</a></li>' . 167 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack moon</a></li>'; 168 143 169 $this->AssertEquals( 144 170 $expected['show_fullname'], … … 153 179 154 180 function test_wp_list_authors_hide_empty() { 155 $fred_id = self::$fred_id; 156 $expected['hide_empty'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 181 $fred_id = self::$fred_id; 182 183 $expected['hide_empty'] = 184 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 185 '<li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li>' . 186 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' . 187 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 188 157 189 $this->AssertEquals( 158 190 $expected['hide_empty'], … … 167 199 168 200 function test_wp_list_authors_echo() { 169 $expected['echo'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 201 $expected['echo'] = 202 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>' . 203 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>' . 204 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 205 170 206 $this->expectOutputString( $expected['echo'] ); 171 207 wp_list_authors( array( 'echo' => true ) ); … … 173 209 174 210 function test_wp_list_authors_feed() { 175 $url0 = get_author_feed_link( self::$user_ids[0] ); 176 $url1 = get_author_feed_link( self::$user_ids[1] ); 177 $url2 = get_author_feed_link( self::$user_ids[2] ); 178 $expected['feed'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>'; 211 $url0 = get_author_feed_link( self::$user_ids[0] ); 212 $url1 = get_author_feed_link( self::$user_ids[1] ); 213 $url2 = get_author_feed_link( self::$user_ids[2] ); 214 215 $expected['feed'] = 216 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' . 217 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' . 218 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>'; 219 179 220 $this->AssertEquals( 180 221 $expected['feed'], … … 189 230 190 231 function test_wp_list_authors_feed_image() { 191 $url0 = get_author_feed_link( self::$user_ids[0] ); 192 $url1 = get_author_feed_link( self::$user_ids[1] ); 193 $url2 = get_author_feed_link( self::$user_ids[2] ); 194 $expected['feed_image'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> <a href="' . $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> <a href="' . $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>'; 232 $url0 = get_author_feed_link( self::$user_ids[0] ); 233 $url1 = get_author_feed_link( self::$user_ids[1] ); 234 $url2 = get_author_feed_link( self::$user_ids[2] ); 235 236 $expected['feed_image'] = 237 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> <a href="' . $url1 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' . 238 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> <a href="' . $url2 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>' . 239 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> <a href="' . $url0 . '"><img src="http://' . WP_TESTS_DOMAIN . '/path/to/a/graphic.png" style="border: none;" /></a></li>'; 240 195 241 $this->AssertEquals( 196 242 $expected['feed_image'], … … 208 254 */ 209 255 function test_wp_list_authors_feed_type() { 210 $url0 = get_author_feed_link( self::$user_ids[0], 'atom' ); 211 $url1 = get_author_feed_link( self::$user_ids[1], 'atom' ); 212 $url2 = get_author_feed_link( self::$user_ids[2], 'atom' ); 213 $expected['feed_type'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>'; 256 $url0 = get_author_feed_link( self::$user_ids[0], 'atom' ); 257 $url1 = get_author_feed_link( self::$user_ids[1], 'atom' ); 258 $url2 = get_author_feed_link( self::$user_ids[2], 'atom' ); 259 260 $expected['feed_type'] = 261 '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a> (<a href="' . $url1 . '">link to feed</a>)</li>' . 262 '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a> (<a href="' . $url2 . '">link to feed</a>)</li>' . 263 '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a> (<a href="' . $url0 . '">link to feed</a>)</li>'; 264 214 265 $this->AssertEquals( 215 266 $expected['feed_type'], … … 225 276 226 277 function test_wp_list_authors_style() { 227 $expected['style'] = '<a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a>, <a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a>, <a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a>'; 278 $expected['style'] = 279 '<a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a>, ' . 280 '<a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a>, ' . 281 '<a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a>'; 282 228 283 $this->AssertEquals( 229 284 $expected['style'], … … 239 294 function test_wp_list_authors_html() { 240 295 $expected['html'] = 'bob, paul, zack'; 296 241 297 $this->AssertEquals( 242 298 $expected['html'],
Note: See TracChangeset
for help on using the changeset viewer.