Changeset 42343 for trunk/tests/phpunit/tests/user/author.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/user/author.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/author.php
r41173 r42343 9 9 class Tests_User_Author_Template extends WP_UnitTestCase { 10 10 protected static $author_id = 0; 11 protected static $post_id = 0;11 protected static $post_id = 0; 12 12 13 13 private $permalink_structure; 14 14 15 15 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 16 self::$author_id = $factory->user->create( array( 17 'role' => 'author', 18 'user_login' => 'test_author', 19 'description' => 'test_author', 20 ) ); 16 self::$author_id = $factory->user->create( 17 array( 18 'role' => 'author', 19 'user_login' => 'test_author', 20 'description' => 'test_author', 21 ) 22 ); 21 23 22 self::$post_id = $factory->post->create( array( 23 'post_author' => self::$author_id, 24 'post_status' => 'publish', 25 'post_content' => rand_str(), 26 'post_title' => rand_str(), 27 'post_type' => 'post' 28 ) ); 24 self::$post_id = $factory->post->create( 25 array( 26 'post_author' => self::$author_id, 27 'post_status' => 'publish', 28 'post_content' => rand_str(), 29 'post_title' => rand_str(), 30 'post_type' => 'post', 31 ) 32 ); 29 33 } 30 34 … … 42 46 function test_get_the_author() { 43 47 $author_name = get_the_author(); 44 $user = new WP_User( self::$author_id );48 $user = new WP_User( self::$author_id ); 45 49 46 50 $this->assertEquals( $user->display_name, $author_name ); … … 89 93 register_post_type( 'wptests_pt' ); 90 94 91 $cpt_ids = self::factory()->post->create_many( 2, array( 92 'post_author' => self::$author_id, 93 'post_type' => 'wptests_pt', 94 ) ); 95 $cpt_ids = self::factory()->post->create_many( 96 2, array( 97 'post_author' => self::$author_id, 98 'post_type' => 'wptests_pt', 99 ) 100 ); 95 101 $GLOBALS['post'] = $cpt_ids[0]; 96 102 … … 104 110 */ 105 111 public function test_get_the_author_posts_link_no_permalinks() { 106 $author = self::factory()->user->create_and_get( array( 107 'display_name' => 'Foo', 108 'user_nicename' => 'bar' 109 ) ); 112 $author = self::factory()->user->create_and_get( 113 array( 114 'display_name' => 'Foo', 115 'user_nicename' => 'bar', 116 ) 117 ); 110 118 111 119 $GLOBALS['authordata'] = $author->data; … … 128 136 $this->set_permalink_structure( '/%postname%/' ); 129 137 130 $author = self::factory()->user->create_and_get( array( 131 'display_name' => 'Foo', 132 'user_nicename' => 'bar' 133 ) ); 138 $author = self::factory()->user->create_and_get( 139 array( 140 'display_name' => 'Foo', 141 'user_nicename' => 'bar', 142 ) 143 ); 134 144 135 145 $GLOBALS['authordata'] = $author;
Note: See TracChangeset
for help on using the changeset viewer.