public function AgreementCustomUnprivilegedUserTestCase::testAgreementFrequency in Agreement 6.2
Same name and namespace in other branches
- 7.2 agreement.test \AgreementCustomUnprivilegedUserTestCase::testAgreementFrequency()
File
- ./
agreement.test, line 225 - Tests for Agreement module.
Class
Code
public function testAgreementFrequency() {
// A) Agreement required once
variable_set('agreement_page_visibility_settings', 1);
variable_set('agreement_page_visibility_pages', '<front>');
$this
->unprivilegedUserLogin();
// Go to front page, open agreement
$this
->drupalGet('node');
$this
->isAgreementPage();
$this
->submitAgreementFormWithAgreeing($this->unprivileged_user->uid);
// Log out, log back in, no agreement
$this
->drupalLogin($this->unprivileged_user);
$this
->drupalGet('node');
$this
->isNotAgreementPage();
// B) Agreement required on every login
variable_set('agreement_frequency', 1);
$this
->drupalLogin($this->unprivileged_user);
// Go to front page, open agreement
$this
->drupalGet('node');
$this
->isAgreementPage();
$this
->submitAgreementFormWithAgreeing($this->unprivileged_user->uid);
// Log out, log back in, open agreement
$this
->drupalLogin($this->unprivileged_user);
$this
->drupalGet('node');
$this
->isAgreementPage();
// Change password, no agreement
$this
->submitAgreementFormWithAgreeing($this->unprivileged_user->uid);
variable_set('agreement_page_visibility_pages', '');
$edit = array(
'pass[pass1]' => $pass = $this
->randomString(),
'pass[pass2]' => $pass,
);
$this
->drupalPost('user/' . $this->unprivileged_user->uid . '/edit', $edit, t('Save'));
$this
->isNotAgreementPage();
$this
->assertText(t('The changes have been saved.'), t('Password was changed'));
}