1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
require_once __DIR__ . '/simple_include.php'; |
4
|
|
|
require_once __DIR__ . '/calendar_include.php'; |
5
|
|
|
|
6
|
|
|
Mock::generate('Calendar_Engine_Interface', 'Mock_Calendar_Engine'); |
|
|
|
|
7
|
|
|
Mock::generate('Calendar_Second', 'Mock_Calendar_Second'); |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class TestOfTableHelper. |
11
|
|
|
*/ |
12
|
|
|
class TestOfTableHelper extends UnitTestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
public $mockengine; |
15
|
|
|
public $mockcal; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* TestOfTableHelper constructor. |
19
|
|
|
*/ |
20
|
|
|
public function __construct() |
21
|
|
|
{ |
22
|
|
|
parent::__construct('Test of Calendar_Table_Helper'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
protected function setUp() |
26
|
|
|
{ |
27
|
|
|
$this->mockengine = new Mock_Calendar_Engine($this); |
|
|
|
|
28
|
|
|
$this->mockengine->setReturnValue('getMinYears', 1970); |
29
|
|
|
$this->mockengine->setReturnValue('getMaxYears', 2037); |
30
|
|
|
$this->mockengine->setReturnValue('getMonthsInYear', 12); |
31
|
|
|
$this->mockengine->setReturnValue('getDaysInMonth', 31); |
32
|
|
|
$this->mockengine->setReturnValue('getHoursInDay', 24); |
33
|
|
|
$this->mockengine->setReturnValue('getMinutesInHour', _EXTCAL_TS_MINUTE); |
34
|
|
|
$this->mockengine->setReturnValue('getSecondsInMinute', _EXTCAL_TS_MINUTE); |
35
|
|
|
$this->mockengine->setReturnValue('getWeekDays', [0, 1, 2, 3, 4, 5, 6]); |
36
|
|
|
$this->mockengine->setReturnValue('getDaysInWeek', 7); |
37
|
|
|
$this->mockengine->setReturnValue('getFirstDayOfWeek', 1); |
38
|
|
|
$this->mockengine->setReturnValue('getFirstDayInMonth', 3); |
39
|
|
|
$this->mockcal = new Mock_Calendar_Second($this); |
|
|
|
|
40
|
|
|
$this->mockcal->setReturnValue('thisYear', 2003); |
41
|
|
|
$this->mockcal->setReturnValue('thisMonth', 10); |
42
|
|
|
$this->mockcal->setReturnValue('thisDay', 15); |
43
|
|
|
$this->mockcal->setReturnValue('thisHour', 13); |
44
|
|
|
$this->mockcal->setReturnValue('thisMinute', 30); |
45
|
|
|
$this->mockcal->setReturnValue('thisSecond', 45); |
46
|
|
|
$this->mockcal->setReturnValue('getEngine', $this->mockengine); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function testGetFirstDay() |
50
|
|
|
{ |
51
|
|
|
for ($i = 0; $i <= 7; ++$i) { |
52
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal, $i); |
53
|
|
|
$this->assertEqual($Helper->getFirstDay(), $i); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function testGetDaysOfWeekMonday() |
58
|
|
|
{ |
59
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
60
|
|
|
$this->assertEqual($Helper->getDaysOfWeek(), [1, 2, 3, 4, 5, 6, 0]); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function testGetDaysOfWeekSunday() |
64
|
|
|
{ |
65
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal, 0); |
66
|
|
|
$this->assertEqual($Helper->getDaysOfWeek(), [0, 1, 2, 3, 4, 5, 6]); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testGetDaysOfWeekThursday() |
70
|
|
|
{ |
71
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal, 4); |
72
|
|
|
$this->assertEqual($Helper->getDaysOfWeek(), [4, 5, 6, 0, 1, 2, 3]); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function testGetNumWeeks() |
76
|
|
|
{ |
77
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
78
|
|
|
$this->assertEqual($Helper->getNumWeeks(), 5); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function testGetNumTableDaysInMonth() |
82
|
|
|
{ |
83
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
84
|
|
|
$this->assertEqual($Helper->getNumTableDaysInMonth(), 35); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function testGetEmptyDaysBefore() |
88
|
|
|
{ |
89
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
90
|
|
|
$this->assertEqual($Helper->getEmptyDaysBefore(), 2); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
public function testGetEmptyDaysAfter() |
94
|
|
|
{ |
95
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
96
|
|
|
$this->assertEqual($Helper->getEmptyDaysAfter(), 33); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
public function testGetEmptyDaysAfterOffset() |
100
|
|
|
{ |
101
|
|
|
$Helper = new Calendar_Table_Helper($this->mockcal); |
102
|
|
|
$this->assertEqual($Helper->getEmptyDaysAfterOffset(), 5); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
if (!defined('TEST_RUNNING')) { |
107
|
|
|
define('TEST_RUNNING', true); |
108
|
|
|
$test = new TestOfTableHelper(); |
109
|
|
|
$test->run(new HtmlReporter()); |
|
|
|
|
110
|
|
|
} |
111
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths