You are here

public function AgreementRecordsViewsTest::testAgreementRecordsView in Agreement 8.2

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

Asserts that there is a row for users whether they have agreed or not.

File

tests/src/Functional/AgreementRecordsViewsTest.php, line 15

Class

AgreementRecordsViewsTest
Tests the default view showing users that have agreed.

Namespace

Drupal\Tests\agreement\Functional

Code

public function testAgreementRecordsView() {
  $unprivilegedUser = $this
    ->createUnprivilegedUser();
  $this
    ->drupalLogin($unprivilegedUser);

  // Sent to agreement page.
  $this
    ->assertAgreementPage($this->agreement);

  // Try submitting agreement form.
  $this
    ->assertAgreed($this->agreement);

  // Create a privileged user.
  $privilegedUser = $this
    ->createPrivilegedUser();
  $this
    ->drupalLogin($privilegedUser);

  // Go to the agreement configure page.
  $this
    ->drupalGet('/admin/config/people/agreement/agreements');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContainsOnce('✔');
  $this
    ->assertSession()
    ->pageTextContains('✖');
}