Page MenuHomeWickedGov Phorge

TimeBasedTerminationConditionTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

TimeBasedTerminationConditionTest.php

<?php
namespace Eris\Quantifier;
use DateInterval;
class TimeBasedTerminationConditionTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Closure
*/
private $time;
/**
* @var int
*/
private $currentTime;
/**
* @var TimeBasedTerminationCondition
*/
private $condition;
protected function setUp(): void
{
$this->time = function () {
return $this->currentTime;
};
$this->currentTime = 1300000000;
$this->condition = new TimeBasedTerminationCondition(
$this->time,
new DateInterval('PT1800S')
);
}
public function testDefaultsToNotTerminateAtStartup()
{
$this->condition->startPropertyVerification();
$this->assertFalse(
$this->condition->shouldTerminate()
);
}
public function testWhenAnIntervalShorterThanTheMaximumIntervalIsElapsedChoosesNotToTerminate()
{
$this->condition->startPropertyVerification();
$this->currentTime = 1300001000;
$this->assertFalse(
$this->condition->shouldTerminate()
);
}
public function testWhenTheMaximumIntervalIsElapsedChoosesToTerminate()
{
$this->condition->startPropertyVerification();
$this->currentTime = 1300002000;
$this->assertTrue(
$this->condition->shouldTerminate()
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Aug 19, 15:54 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ed/2f/3a1b761c778f83a7c4cc55454505
Default Alt Text
TimeBasedTerminationConditionTest.php (1 KB)

Event Timeline