You are here

public function AgreementTestBase::assertNotAgreed in Agreement 8.2

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

Asserts that the user has not agreed to the agreement.

Parameters

\Drupal\agreement\Entity\Agreement $agreement: The agreement to agree to.

Throws

\Behat\Mink\Exception\ResponseTextException

5 calls to AgreementTestBase::assertNotAgreed()
AgreementAnonymousTest::testAgreement in tests/src/Functional/AgreementAnonymousTest.php
Tests agreement as anonymous user.
AgreementDefaultsPrivilegedUserTest::testAgreement in tests/src/Functional/AgreementDefaultsPrivilegedUserTest.php
Asserts that the default settings work for the admin user.
AgreementDefaultsUnprivilegedUserTest::testAgreement in tests/src/Functional/AgreementDefaultsUnprivilegedUserTest.php
Asserts that the default settings work for the end user.
AgreementMultipleRoleTest::testAgreementForFirstRole in tests/src/Functional/AgreementMultipleRoleTest.php
Asserts that the user with the first role gets the agreement page.
AgreementMultipleRoleTest::testAgreementForSecondRole in tests/src/Functional/AgreementMultipleRoleTest.php
Asserts that the user with the second role gets the agreement page.
1 method overrides AgreementTestBase::assertNotAgreed()
AgreementMultilingualTest::assertNotAgreed in tests/src/Functional/AgreementMultilingualTest.php
Asserts that the user has not agreed to the agreement.

File

tests/src/Functional/AgreementTestBase.php, line 207

Class

AgreementTestBase
Tests the agreement functionality.

Namespace

Drupal\Tests\agreement\Functional

Code

public function assertNotAgreed(Agreement $agreement) {
  $settings = $agreement
    ->getSettings();
  $this
    ->drupalPostForm($agreement
    ->get('path'), [], $settings['submit']);
  $this
    ->assertSession()
    ->pageTextContains($settings['failure']);
}