Changeset 35244 for trunk/tests/phpunit/tests/user/listAuthors.php
- Timestamp:
- 10/17/2015 07:24:20 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/listAuthors.php
r35242 r35244 5 5 */ 6 6 class Tests_User_ListAuthors extends WP_UnitTestCase { 7 static $user s = array();7 static $user_ids = array(); 8 8 static $fred_id; 9 9 static $posts = array(); … … 25 25 */ 26 26 public static function wpSetUpBeforeClass( $factory ) { 27 self::$user s[] = $factory->user->create( array( 'user_login' => 'zack', 'display_name' => 'zack', 'role' => 'author', 'first_name' => 'zack', 'last_name' => 'moon' ) );28 self::$user s[] = $factory->user->create( array( 'user_login' => 'bob', 'display_name' => 'bob', 'role' => 'author', 'first_name' => 'bob', 'last_name' => 'reno' ) );29 self::$user s[] = $factory->user->create( array( 'user_login' => 'paul', 'display_name' => 'paul', 'role' => 'author', 'first_name' => 'paul', 'last_name' => 'norris' ) );27 self::$user_ids[] = $factory->user->create( array( 'user_login' => 'zack', 'display_name' => 'zack', 'role' => 'author', 'first_name' => 'zack', 'last_name' => 'moon' ) ); 28 self::$user_ids[] = $factory->user->create( array( 'user_login' => 'bob', 'display_name' => 'bob', 'role' => 'author', 'first_name' => 'bob', 'last_name' => 'reno' ) ); 29 self::$user_ids[] = $factory->user->create( array( 'user_login' => 'paul', 'display_name' => 'paul', 'role' => 'author', 'first_name' => 'paul', 'last_name' => 'norris' ) ); 30 30 self::$fred_id = $factory->user->create( array( 'user_login' => 'fred', 'role' => 'author' ) ); 31 31 32 32 $count = 0; 33 foreach ( self::$user s as $userid ) {33 foreach ( self::$user_ids as $userid ) { 34 34 $count = $count + 1; 35 35 for ( $i = 0; $i < $count; $i++ ) { … … 42 42 43 43 public static function wpTearDownAfterClass() { 44 foreach ( array_merge( self::$users, array( self::$fred_id ) ) as $user_id ) { 44 self::$user_ids[] = self::$fred_id; 45 46 foreach ( self::$user_ids as $user_id ) { 45 47 self::delete_user( $user_id ); 46 48 } … … 97 99 98 100 function test_wp_list_authors_feed() { 99 $url0 = get_author_feed_link( self::$user s[0] );100 $url1 = get_author_feed_link( self::$user s[1] );101 $url2 = get_author_feed_link( self::$user s[2] );101 $url0 = get_author_feed_link( self::$user_ids[0] ); 102 $url1 = get_author_feed_link( self::$user_ids[1] ); 103 $url2 = get_author_feed_link( self::$user_ids[2] ); 102 104 $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>'; 103 105 $this->AssertEquals( $expected['feed'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed' ) ) ); … … 105 107 106 108 function test_wp_list_authors_feed_image() { 107 $url0 = get_author_feed_link( self::$user s[0] );108 $url1 = get_author_feed_link( self::$user s[1] );109 $url2 = get_author_feed_link( self::$user s[2] );109 $url0 = get_author_feed_link( self::$user_ids[0] ); 110 $url1 = get_author_feed_link( self::$user_ids[1] ); 111 $url2 = get_author_feed_link( self::$user_ids[2] ); 110 112 $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>'; 111 113 $this->AssertEquals( $expected['feed_image'], wp_list_authors( array( 'echo' => false, 'feed_image' => WP_TESTS_DOMAIN . '/path/to/a/graphic.png' ) ) ); … … 116 118 */ 117 119 function test_wp_list_authors_feed_type() { 118 $url0 = get_author_feed_link( self::$user s[0], 'atom' );119 $url1 = get_author_feed_link( self::$user s[1], 'atom' );120 $url2 = get_author_feed_link( self::$user s[2], 'atom' );120 $url0 = get_author_feed_link( self::$user_ids[0], 'atom' ); 121 $url1 = get_author_feed_link( self::$user_ids[1], 'atom' ); 122 $url2 = get_author_feed_link( self::$user_ids[2], 'atom' ); 121 123 $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>'; 122 124 $this->AssertEquals( $expected['feed_type'], wp_list_authors( array( 'echo' => false, 'feed' => 'link to feed', 'feed_type' => 'atom' ) ) );
Note: See TracChangeset
for help on using the changeset viewer.