You are here

public function DigestTest::testProcessTimeThreshold in Message Digest 8

Test that digests will be processed at the correct time.

@covers ::processDigest

@dataProvider processTimeProvider

File

tests/src/Unit/Plugin/Notifier/DigestTest.php, line 173

Class

DigestTest
Tests the Digest plugin.

Namespace

Drupal\Tests\message_digest\Unit\Plugin\Notifier

Code

public function testProcessTimeThreshold($currentTime, $lastRun, $expectation) {
  $time = $this
    ->prophesize(TimeInterface::class);
  $time
    ->getRequestTime()
    ->willReturn($currentTime);
  $this->time = $time
    ->reveal();
  $state = $this
    ->prophesize(StateInterface::class);
  $state
    ->get($this->pluginId . '_last_run', 0)
    ->willReturn($lastRun);
  $this->state = $state
    ->reveal();
  $message = $this
    ->prophesize(MessageInterface::class)
    ->reveal();
  $notifier = $this
    ->getNotifier($message);
  self::assertEquals($expectation, $notifier
    ->processDigest());
}