You are here

protected function SocialAuthTestBase::checkLinkToProviderExists in Social Auth 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SocialAuthTestBase.php \Drupal\Tests\social_auth\Functional\SocialAuthTestBase::checkLinkToProviderExists()

Test if link to provider exists in login block.

Throws

\Behat\Mink\Exception\ResponseTextException

1 call to SocialAuthTestBase::checkLinkToProviderExists()
SocialAuthLoginBlockTest::testBlockExists in tests/src/Functional/SocialAuthLoginBlockTest.php
Test that the block is showing up.

File

tests/src/Functional/SocialAuthTestBase.php, line 66

Class

SocialAuthTestBase
Defines a base class for testing Social Auth implementers.

Namespace

Drupal\Tests\social_auth\Functional

Code

protected function checkLinkToProviderExists() {

  // Test for a non-authenticated user.
  $this
    ->drupalGet(Url::fromRoute('<front>'));
  $this
    ->assertSession()
    ->pageTextContains($this->socialAuthLoginBlock
    ->label());
  if ($this->provider) {
    $this
      ->checkPathInBlock($this->authRootPath . $this->provider);
  }

  // Test for an authenticated user.
  $this
    ->drupalLogin($this->noPermsUser);
  $this
    ->drupalGet(Url::fromRoute('<front>'));
  $this
    ->assertSession()
    ->pageTextContains($this->socialAuthLoginBlock
    ->label());
  if ($this->provider) {
    $this
      ->checkPathInBlock($this->authRootPath . $this->provider);
  }
}