class TestAuthenticationProvider

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php \Drupal\Tests\Core\Authentication\TestAuthenticationProvider
  2. 8.9.x core/tests/Drupal/Tests/Core/Authentication/AuthenticationCollectorTest.php \Drupal\Tests\Core\Authentication\TestAuthenticationProvider
  3. 10 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 59

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

Title Sort descending Modifiers Object type Summary Overriden Title
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.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.