You are here

public function AgreementCustomFrequencyTest::testAgreement in Agreement 3.0.x

Asserts agreement functionality.

File

tests/src/Functional/AgreementCustomFrequencyTest.php, line 54

Class

AgreementCustomFrequencyTest
Tests custom frequencies.

Namespace

Drupal\Tests\agreement\Functional

Code

public function testAgreement() {
  $this
    ->drupalLogin($this->unprivilegedAccount);
  $this
    ->assertAgreementPage($this->agreement);
  $this
    ->assertAgreed($this->agreement);

  // Updates the user's agreed time te before the custom frequency.
  $moreThanSixHoursAgo = time() - 22000;
  \Drupal::database()
    ->update('agreement')
    ->fields([
    'agreed_date' => $moreThanSixHoursAgo,
  ])
    ->condition('uid', $this->unprivilegedAccount
    ->id())
    ->execute();
  $this
    ->drupalGet('/node/2');
  $this
    ->assertAgreementPage($this->agreement);
}