Passed
Branch master (73f5a3)
by Toni
02:45
created

UntilTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A includes_GivenMoreRecentDate_ShouldReturnFalse() 0 8 1
A includes_GivenOlderDate_ShouldReturnTrue() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Adlogix\EventSchedulerTest\TemporalExpression;
6
7
use DateTime;
8
use PHPUnit\Framework\TestCase;
9
use Adlogix\EventScheduler\TemporalExpression\Until;
10
11
class UntilTest extends TestCase
12
{
13
    /**
14
     * @test
15
     */
16
    public function includes_GivenOlderDate_ShouldReturnTrue()
17
    {
18
        $date = new DateTime('2015-04-12');
19
        $expr = new Until($date);
20
21
        $isIncluded = $expr->includes(new DateTime('2015-04-11'));
22
23
        $this->assertThat($isIncluded, $this->isTrue());
24
    }
25
26
    /**
27
     * @test
28
     */
29
    public function includes_GivenMoreRecentDate_ShouldReturnFalse()
30
    {
31
        $date = new DateTime('2015-04-12');
32
        $expr = new Until($date);
33
34
        $isIncluded = $expr->includes(new DateTime('2015-04-13'));
35
36
        $this->assertThat($isIncluded, $this->isFalse());
37
    }
38
}
39