You are here

public function AgreementMultipleRoleTest::testNoAgreementWithoutRole in Agreement 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Functional/AgreementMultipleRoleTest.php \Drupal\Tests\agreement\Functional\AgreementMultipleRoleTest::testNoAgreementWithoutRole()

Asserts that user does not get agreement page without those roles.

File

tests/src/Functional/AgreementMultipleRoleTest.php, line 104

Class

AgreementMultipleRoleTest
Tests agreement that applies to multiple roles.

Namespace

Drupal\Tests\agreement\Functional

Code

public function testNoAgreementWithoutRole() {

  // Create the user account.
  $unprivilegedUser = $this
    ->createUnprivilegedUser();

  // Log in as the user, no agreement.
  $this
    ->drupalLogin($unprivilegedUser);
  $this
    ->assertNotAgreementPage($this->agreement);

  // Go to front page, no agreement.
  $this
    ->drupalGet('/node');
  $this
    ->assertNotAgreementPage($this->agreement);

  // Go anywhere else, no agreement.
  $this
    ->drupalGet('/user/' . $unprivilegedUser
    ->id());
  $this
    ->assertNotAgreementPage($this->agreement);
}