diff --git a/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php b/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php index 8a289b0..c397f63 100644 --- a/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php +++ b/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php @@ -4,6 +4,9 @@ /** * Provides common functionality for Basic Authentication test classes. + * + * @deprecated Scheduled for removal in Drupal 9.0.0. + * Use \Drupal\Tests\basic_auth\Traits\BasicAuthTestTrait instead. */ trait BasicAuthTestTrait { diff --git a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php similarity index 96% rename from core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php rename to core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php index 3650e4f..b197a76 100644 --- a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php +++ b/core/modules/basic_auth/tests/src/Functional/BasicAuthTest.php @@ -1,19 +1,19 @@ basicAuthGet($url, $account->getUsername(), $account->pass_raw); $this->assertText($account->getUsername(), 'Account name is displayed.'); $this->assertResponse('200', 'HTTP response is OK'); - $this->curlClose(); + $this->mink->resetSessions(); $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache')); $this->assertIdentical(strpos($this->drupalGetHeader('Cache-Control'), 'public'), FALSE, 'Cache-Control is not set to public'); $this->basicAuthGet($url, $account->getUsername(), $this->randomMachineName()); $this->assertNoText($account->getUsername(), 'Bad basic auth credentials do not authenticate the user.'); $this->assertResponse('403', 'Access is not granted.'); - $this->curlClose(); + $this->mink->resetSessions(); $this->drupalGet($url); $this->assertEqual($this->drupalGetHeader('WWW-Authenticate'), SafeMarkup::format('Basic realm="@realm"', ['@realm' => \Drupal::config('system.site')->get('name')])); @@ -60,7 +60,7 @@ public function testBasicAuth() { $this->basicAuthGet(Url::fromRoute('system.admin'), $account->getUsername(), $account->pass_raw); $this->assertNoLink('Log out', 'User is not logged in'); $this->assertResponse('403', 'No basic authentication for routes not explicitly defining authentication providers.'); - $this->curlClose(); + $this->mink->resetSessions(); // Ensure that pages already in the page cache aren't returned from page // cache if basic auth credentials are provided. @@ -148,7 +148,6 @@ public function testLocale() { $this->basicAuthGet($url, $account->getUsername(), $account->pass_raw); $this->assertText($account->getUsername(), 'Account name is displayed.'); $this->assertResponse('200', 'HTTP response is OK'); - $this->curlClose(); } /** @@ -197,6 +196,8 @@ public function testControllerNotCalledBeforeAuth() { $this->basicAuthGet('/basic_auth_test/state/modify', $account->getUsername(), $account->pass_raw); $this->assertResponse(200); $this->assertRaw('Done'); + + $this->mink->resetSessions(); $this->drupalGet('/basic_auth_test/state/read'); $this->assertResponse(200); $this->assertRaw('yep'); diff --git a/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php b/core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php similarity index 95% copy from core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php copy to core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php index 8a289b0..f848220 100644 --- a/core/modules/basic_auth/src/Tests/BasicAuthTestTrait.php +++ b/core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php @@ -1,6 +1,6 @@ 'Basic ' . base64_encode("$username:$password")]; } }