You are here

protected function BasicAuthTestTrait::basicAuthGet in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php \Drupal\Tests\basic_auth\Traits\BasicAuthTestTrait::basicAuthGet()
  2. 9 core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php \Drupal\Tests\basic_auth\Traits\BasicAuthTestTrait::basicAuthGet()

Retrieves a Drupal path or an absolute path using basic authentication.

Parameters

\Drupal\Core\Url|string $path: Drupal path or URL to load into the internal browser.

string $username: The username to use for basic authentication.

string $password: The password to use for basic authentication.

array $options: (optional) Options to be forwarded to the url generator.

Return value

string The retrieved HTML string, also available as $this->getRawContent().

3 calls to BasicAuthTestTrait::basicAuthGet()
SessionAuthenticationTest::testBasicAuthNoSession in core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php
Tests that a session is not started automatically by basic authentication.
SessionAuthenticationTest::testBasicAuthSession in core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php
Tests if a session can be initiated through basic authentication.
SessionAuthenticationTest::testSessionFromBasicAuthenticationDoesNotLeak in core/modules/system/tests/src/Functional/Session/SessionAuthenticationTest.php
Check that a basic authentication session does not leak.

File

core/modules/basic_auth/tests/src/Traits/BasicAuthTestTrait.php, line 25

Class

BasicAuthTestTrait
Provides common functionality for Basic Authentication test classes.

Namespace

Drupal\Tests\basic_auth\Traits

Code

protected function basicAuthGet($path, $username, $password, array $options = []) {
  return $this
    ->drupalGet($path, $options, $this
    ->getBasicAuthHeaders($username, $password));
}