-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCalendarTest.php
More file actions
60 lines (55 loc) · 2.46 KB
/
CalendarTest.php
File metadata and controls
60 lines (55 loc) · 2.46 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
56
57
58
59
60
<?php
namespace Vestaboard\Vbml\Tests;
use PHPUnit\Framework\TestCase;
use Vestaboard\Vbml\Calendar;
class CalendarTest extends TestCase
{
public function testShouldCreateCalendarWithOnly4Weeks(): void
{
$result = Calendar::makeCalendar(
'2',
'2026',
[]
);
$this->assertEquals([
[28, 59, 28, 32, 0, 19, 13, 20, 23, 20, 6, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 27, 44, 33, 0, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 34, 44, 27, 30, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[27, 31, 44, 28, 27, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[28, 28, 44, 28, 34, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
], $result);
}
public function testShouldRenderSingleDateHeaderWhenLastWeekHas1Day(): void
{
$result = Calendar::makeCalendar(
'2',
'2027',
[]
);
$this->assertEquals([
[28, 59, 28, 33, 0, 19, 13, 20, 23, 20, 6, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 27, 44, 32, 0, 0, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 33, 44, 27, 29, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[27, 30, 44, 28, 36, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[28, 27, 44, 28, 33, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[28, 34, 0, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
], $result);
}
public function testShouldNotHighlightDaysOutsideOfMonth(): void
{
$result = Calendar::makeCalendar(
'6',
'2026',
["30" => 67, "31" => 67, "32" => 67]
);
$this->assertEquals([
[32, 59, 28, 32, 0, 19, 13, 20, 23, 20, 6, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 27, 44, 32, 0, 0, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 33, 44, 27, 29, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[27, 30, 44, 28, 36, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[28, 27, 44, 28, 33, 65, 65, 65, 65, 65, 65, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[28, 34, 44, 29, 36, 65, 65, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
], $result);
}
}