MatchDaysTest.php
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace FootyRoom\Tests\Unit\Match;
use FootyRoom\Core\Match\MatchDays;
use FootyRoom\Tests\TestCase;
use MongoDB\BSON\UTCDateTime;
class MatchDaysTest extends TestCase
{
/**
* @covers \MatchDays::getDays
*/
public function testGetDays()
{
$matchTimes = [
new UTCDateTime(strtotime('2014/06/12T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/12T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/06/13T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/08T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/13T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/06/13T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/06/13T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/06/29T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/12T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/12T00:00:00') * 1000),
new UTCDateTime(strtotime('2014/07/12T00:00:00') * 1000),
];
$expectedDays = [
'days' => [
'2014/06/12',
'2014/06/13',
'2014/06/29',
'2014/07/08',
'2014/07/12',
'2014/07/13',
],
'currentDay' => '2014/07/13',
];
$days = MatchDays::getDays($matchTimes);
sort($days['days']);
$this->assertEquals($expectedDays, $days, 'Days retrieved are not as expected.');
$days = MatchDays::getDays([]);
$this->assertEquals([
'days' => [],
'currentDay' => date('Y/m/d', time()),
], $days, 'When no matches times are given days are not handled correctly.');
}
}