Changeset 50065 for trunk/tests/phpunit/tests/auth.php
- Timestamp:
- 01/29/2021 12:05:20 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/auth.php
r49919 r50065 39 39 wp_set_current_user( self::$user_id ); 40 40 update_site_option( 'using_application_passwords', 1 ); 41 42 unset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $GLOBALS['wp_rest_application_password_status'], $GLOBALS['wp_rest_application_password_uuid'] ); 41 43 } 42 44 … … 45 47 46 48 // Cleanup all the global state. 47 unset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $GLOBALS['wp_rest_application_password_status'] );49 unset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'], $GLOBALS['wp_rest_application_password_status'], $GLOBALS['wp_rest_application_password_uuid'] ); 48 50 } 49 51 … … 443 445 444 446 // Create a new app-only password. 445 list( $user_app_password ) = WP_Application_Passwords::create_new_application_password( $user_id, array( 'name' => 'phpunit' ) );447 list( $user_app_password, $item ) = WP_Application_Passwords::create_new_application_password( $user_id, array( 'name' => 'phpunit' ) ); 446 448 447 449 // Fake a REST API request. … … 453 455 $_SERVER['PHP_AUTH_PW'] = 'http_auth_pass'; 454 456 455 $this->assertSame( 456 null, 457 $this->assertNull( 457 458 wp_validate_application_password( null ), 458 459 'Regular user account password should not be allowed for API authentication' 459 460 ); 461 $this->assertNull( rest_get_authenticated_app_password() ); 460 462 461 463 // Not try with an App password instead. … … 467 469 'Application passwords should be allowed for API authentication' 468 470 ); 471 $this->assertEquals( $item['uuid'], rest_get_authenticated_app_password() ); 469 472 } 470 473
Note: See TracChangeset
for help on using the changeset viewer.