You are here

public function AgreementDefaultsUnprivilegedUserTestCase::testAgreement in Agreement 7.2

Same name and namespace in other branches
  1. 6.2 agreement.test \AgreementDefaultsUnprivilegedUserTestCase::testAgreement()
  2. 6 agreement.test \AgreementDefaultsUnprivilegedUserTestCase::testAgreement()

Tests the agreement page for every page except the front page.

File

./agreement.test, line 266
Tests for Agreement module.

Class

AgreementDefaultsUnprivilegedUserTestCase
Tests the agreement functionality with an unprivileged user.

Code

public function testAgreement() {
  $this
    ->unprivilegedUserLogin();

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

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

  // Go anywhere else, open agreement.
  $this
    ->drupalGet('user/' . $this->unprivilegedUser->uid);
  $this
    ->isAgreementPage($this->agreement);

  // Try submitting agreement form.
  $this
    ->submitAgreementFormWithoutAgreeing($this->unprivilegedUser->uid);
  $this
    ->submitAgreementFormWithAgreeing($this->unprivilegedUser->uid);
  $this
    ->drupalGet('admin/config/people/agreement');
  $this
    ->assertResponse(403, t('User is not allowed to access agreement settings page.'));
}