Changeset 48937 for trunk/tests/phpunit/tests/user/author.php
- Timestamp:
- 09/02/2020 12:35:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/author.php
r47122 r48937 48 48 $user = new WP_User( self::$author_id ); 49 49 50 $this->assert Equals( $user->display_name, $author_name );51 $this->assert Equals( 'test_author', $author_name );50 $this->assertSame( $user->display_name, $author_name ); 51 $this->assertSame( 'test_author', $author_name ); 52 52 } 53 53 54 54 function test_get_the_author_meta() { 55 $this->assert Equals( 'test_author', get_the_author_meta( 'login' ) );56 $this->assert Equals( 'test_author', get_the_author_meta( 'user_login' ) );57 $this->assert Equals( 'test_author', get_the_author_meta( 'display_name' ) );55 $this->assertSame( 'test_author', get_the_author_meta( 'login' ) ); 56 $this->assertSame( 'test_author', get_the_author_meta( 'user_login' ) ); 57 $this->assertSame( 'test_author', get_the_author_meta( 'display_name' ) ); 58 58 59 $this->assert Equals( 'test_author', trim( get_the_author_meta( 'description' ) ) );60 $this->assert Equals( 'test_author', get_the_author_meta( 'user_description' ) );59 $this->assertSame( 'test_author', trim( get_the_author_meta( 'description' ) ) ); 60 $this->assertSame( 'test_author', get_the_author_meta( 'user_description' ) ); 61 61 add_user_meta( self::$author_id, 'user_description', 'user description' ); 62 $this->assert Equals( 'user description', get_user_meta( self::$author_id, 'user_description', true ) );62 $this->assertSame( 'user description', get_user_meta( self::$author_id, 'user_description', true ) ); 63 63 // user_description in meta is ignored. The content of description is returned instead. 64 64 // See #20285. 65 $this->assert Equals( 'test_author', get_the_author_meta( 'user_description' ) );66 $this->assert Equals( 'test_author', trim( get_the_author_meta( 'description' ) ) );65 $this->assertSame( 'test_author', get_the_author_meta( 'user_description' ) ); 66 $this->assertSame( 'test_author', trim( get_the_author_meta( 'description' ) ) ); 67 67 update_user_meta( self::$author_id, 'user_description', '' ); 68 $this->assert Equals( '', get_user_meta( self::$author_id, 'user_description', true ) );69 $this->assert Equals( 'test_author', get_the_author_meta( 'user_description' ) );70 $this->assert Equals( 'test_author', trim( get_the_author_meta( 'description' ) ) );68 $this->assertSame( '', get_user_meta( self::$author_id, 'user_description', true ) ); 69 $this->assertSame( 'test_author', get_the_author_meta( 'user_description' ) ); 70 $this->assertSame( 'test_author', trim( get_the_author_meta( 'description' ) ) ); 71 71 72 $this->assert Equals( '', get_the_author_meta( 'does_not_exist' ) );72 $this->assertSame( '', get_the_author_meta( 'does_not_exist' ) ); 73 73 } 74 74 75 75 function test_get_the_author_meta_no_authordata() { 76 76 unset( $GLOBALS['authordata'] ); 77 $this->assert Equals( '', get_the_author_meta( 'id' ) );78 $this->assert Equals( '', get_the_author_meta( 'user_login' ) );79 $this->assert Equals( '', get_the_author_meta( 'does_not_exist' ) );77 $this->assertSame( '', get_the_author_meta( 'id' ) ); 78 $this->assertSame( '', get_the_author_meta( 'user_login' ) ); 79 $this->assertSame( '', get_the_author_meta( 'does_not_exist' ) ); 80 80 } 81 81 82 82 function test_get_the_author_posts() { 83 83 // Test with no global post, result should be 0 because no author is found. 84 $this->assert Equals( 0, get_the_author_posts() );84 $this->assertSame( 0, get_the_author_posts() ); 85 85 $GLOBALS['post'] = self::$post_id; 86 86 $this->assertEquals( 1, get_the_author_posts() );
Note: See TracChangeset
for help on using the changeset viewer.