Changeset 48937 for trunk/tests/phpunit/tests/auth.php
- Timestamp:
- 09/02/2020 12:35:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/auth.php
r47122 r48937 38 38 function test_auth_cookie_valid() { 39 39 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' ); 40 $this->assert Equals( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );40 $this->assertSame( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) ); 41 41 } 42 42 … … 46 46 47 47 $cookie = wp_generate_auth_cookie( self::$user_id, time() - 7200, 'auth' ); 48 $this->assert Equals( false,wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' );48 $this->assertFalse( wp_validate_auth_cookie( $cookie, 'auth' ), 'expired cookie' ); 49 49 50 50 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' ); 51 $this->assert Equals( false,wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' );51 $this->assertFalse( wp_validate_auth_cookie( $cookie, 'logged_in' ), 'wrong auth scheme' ); 52 52 53 53 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' ); 54 54 list($a, $b, $c) = explode( '|', $cookie ); 55 55 $cookie = $a . '|' . ( $b + 1 ) . '|' . $c; 56 $this->assert Equals( false,wp_validate_auth_cookie( self::$user_id, 'auth' ), 'altered cookie' );56 $this->assertFalse( wp_validate_auth_cookie( self::$user_id, 'auth' ), 'altered cookie' ); 57 57 } 58 58 … … 60 60 // Arbitrary scheme name. 61 61 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' ); 62 $this->assert Equals( self::$user_id, wp_validate_auth_cookie( $cookie, 'foo' ) );62 $this->assertSame( self::$user_id, wp_validate_auth_cookie( $cookie, 'foo' ) ); 63 63 64 64 // Wrong scheme name - should fail. 65 65 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' ); 66 $this->assert Equals( false,wp_validate_auth_cookie( $cookie, 'bar' ) );66 $this->assertFalse( wp_validate_auth_cookie( $cookie, 'bar' ) ); 67 67 } 68 68 … … 83 83 84 84 $this->assertInstanceOf( 'WP_User', $authed_user ); 85 $this->assert Equals( $this->user->ID, $authed_user->ID );85 $this->assertSame( $this->user->ID, $authed_user->ID ); 86 86 } 87 87 } … … 137 137 wp_verify_nonce( $nonce, 'nonce_test_action' ); 138 138 139 $this->assert Equals( ( $count + 1 ), did_action( $this->nonce_failure_hook ) );139 $this->assertSame( ( $count + 1 ), did_action( $this->nonce_failure_hook ) ); 140 140 } 141 141 … … 149 149 wp_verify_nonce( $nonce, 'nonce_test_action' ); 150 150 151 $this->assert Equals( $count, did_action( $this->nonce_failure_hook ) );151 $this->assertSame( $count, did_action( $this->nonce_failure_hook ) ); 152 152 } 153 153 … … 202 202 $user = wp_authenticate( $this->user->user_login, $limit ); 203 203 $this->assertInstanceOf( 'WP_User', $user ); 204 $this->assert Equals( self::$user_id, $user->ID );204 $this->assertSame( self::$user_id, $user->ID ); 205 205 206 206 // One char too many. … … 212 212 $user = get_user_by( 'id', self::$user_id ); 213 213 // Password broken by setting it to be too long. 214 $this->assert Equals( '*', $user->data->user_pass );214 $this->assertSame( '*', $user->data->user_pass ); 215 215 216 216 $user = wp_authenticate( $this->user->user_login, '*' );
Note: See TracChangeset
for help on using the changeset viewer.