Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
57512: Correct PHPCS errors and improve test name in 57512_with_tests…
…_2.diff.
  • Loading branch information
kadamwhite committed Oct 9, 2023
commit d08be4613b4a50a93c215f3129da22facc28ede1
14 changes: 7 additions & 7 deletions tests/phpunit/tests/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,8 @@ public function tests_basic_http_authentication_with_username_and_password() {

wp_populate_basic_auth_from_authorization_header();

$this->assertSame($_SERVER['PHP_AUTH_USER'], 'username');
$this->assertSame($_SERVER['PHP_AUTH_PW'], 'password');
$this->assertSame( $_SERVER['PHP_AUTH_USER'], 'username' );
$this->assertSame( $_SERVER['PHP_AUTH_PW'], 'password' );
}

/*
Expand All @@ -869,21 +869,21 @@ public function tests_basic_http_authentication_with_username_only() {

wp_populate_basic_auth_from_authorization_header();

$this->assertArrayNotHasKey('PHP_AUTH_USER', $_SERVER);
$this->assertArrayNotHasKey('PHP_AUTH_PW', $_SERVER);
$this->assertArrayNotHasKey( 'PHP_AUTH_USER', $_SERVER );
$this->assertArrayNotHasKey( 'PHP_AUTH_PW', $_SERVER );
}

/*
* @ticket 57512
* @covers ::wp_populate_basic_auth_from_authorization_header
*/
public function tests_basic_http_authentication_with_more_than_2_parts() {
public function tests_basic_http_authentication_with_colon_in_password() {
// Header passed as "username:pass:word" where password contains colon.
$_SERVER['HTTP_AUTHORIZATION'] = 'Basic dXNlcm5hbWU6cGFzczp3b3Jk';

wp_populate_basic_auth_from_authorization_header();

$this->assertSame($_SERVER['PHP_AUTH_USER'], 'username');
$this->assertSame($_SERVER['PHP_AUTH_PW'], 'pass:word');
$this->assertSame( $_SERVER['PHP_AUTH_USER'], 'username' );
$this->assertSame( $_SERVER['PHP_AUTH_PW'], 'pass:word' );
}
}