You are here

public function AgreementDefaultsPrivilegedUserTestCase::testAgreement in Agreement 7.2

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

Tests the agreement page functionality.

File

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

Class

AgreementDefaultsPrivilegedUserTestCase
Tests agreement functionality with default use case and a privileged user.

Code

public function testAgreement() {

  // After save, re-open agreement settings.
  $this
    ->assertUrl('admin/config/people/agreement/manage/default', array(), t('URL of settings page is correct: !url', array(
    '!url' => $this
      ->getUrl(),
  )));
  $this
    ->assertTitle('Manage Agreement: Default agreement' . $this->siteName);

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

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

  // Try to go somewhere without submitting.
  $this
    ->drupalGet('node/add');
  $this
    ->isAgreementPage($this->agreement);

  // Try submitting agreement form.
  $this
    ->submitAgreementFormWithoutAgreeing($this->privilegedUser->uid);
  $this
    ->submitAgreementFormWithAgreeing($this->privilegedUser->uid);
  $this
    ->drupalGet('admin');
  $this
    ->isNotAgreementPage($this->agreement);
}