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

DayInWeekTest   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_GivenDateAtSameWeekDay_ShouldReturnTrue() 0 8 1
A includes_GivenDateAtDifferentWeekDay_ShouldReturnFalse() 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\DayInWeek;
10
use Adlogix\EventScheduler\ValueObject\WeekDay;
11
12
class DayInWeekTest extends TestCase
13
{
14
    /**
15
     * @test
16
     */
17
    public function includes_GivenDateAtSameWeekDay_ShouldReturnTrue()
18
    {
19
        $date = new DateTime('2015-04-12');
20
        $expr = DayInWeek::sunday();
21
22
        $isIncluded = $expr->includes($date);
23
24
        $this->assertThat($isIncluded, $this->isTrue());
25
    }
26
27
    /**
28
     * @test
29
     */
30
    public function includes_GivenDateAtDifferentWeekDay_ShouldReturnFalse()
31
    {
32
        $date = new DateTime('2015-04-12');
33
        $expr = DayInWeek::friday();
34
35
        $isIncluded = $expr->includes($date);
36
37
        $this->assertThat($isIncluded, $this->isFalse());
38
    }
39
}
40