You are here

class TestAuthenticationProvider in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php \Drupal\Tests\Core\Authentication\TestAuthenticationProvider

A simple provider for unit testing AuthenticationCollector.

Hierarchy

Expanded class hierarchy of TestAuthenticationProvider

File

core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php, line 65
Contains \Drupal\Tests\Core\Authentication\AuthenticationCollectorTest.

Namespace

Drupal\Tests\Core\Authentication
View source
class TestAuthenticationProvider implements AuthenticationProviderInterface {

  /**
   * The provider id.
   *
   * @var string
   */
  public $providerId;

  /**
   * Constructor.
   */
  public function __construct($provider_id) {
    $this->providerId = $provider_id;
  }

  /**
   * {@inheritdoc}
   */
  public function applies(Request $request) {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function authenticate(Request $request) {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TestAuthenticationProvider::$providerId public property The provider id.
TestAuthenticationProvider::applies public function Checks whether suitable authentication credentials are on the request. Overrides AuthenticationProviderInterface::applies
TestAuthenticationProvider::authenticate public function Authenticates the user. Overrides AuthenticationProviderInterface::authenticate
TestAuthenticationProvider::__construct public function Constructor.