mambax7 /
extcal
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | require_once __DIR__ . '/simple_include.php'; |
||
| 4 | require_once __DIR__ . '/calendar_include.php'; |
||
| 5 | |||
| 6 | require_once __DIR__ . '/./calendar_test.php'; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class TestOfYear. |
||
| 10 | */ |
||
| 11 | class TestOfYear extends TestOfCalendar |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * TestOfYear constructor. |
||
| 15 | */ |
||
| 16 | public function __construct() |
||
| 17 | { |
||
| 18 | $this->UnitTestCase('Test of Year'); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function setUp() |
||
| 22 | { |
||
| 23 | $this->cal = new Calendar_Year(2003); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function testPrevYear_Object() |
||
| 27 | { |
||
| 28 | $this->assertEqual(new Calendar_Year(2002), $this->cal->prevYear('object')); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function testThisYear_Object() |
||
| 32 | { |
||
| 33 | $this->assertEqual(new Calendar_Year(2003), $this->cal->thisYear('object')); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function testPrevMonth() |
||
| 37 | { |
||
| 38 | $this->assertEqual(12, $this->cal->prevMonth()); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testPrevMonth_Array() |
||
| 42 | { |
||
| 43 | $this->assertEqual([ |
||
| 44 | 'year' => 2002, |
||
| 45 | 'month' => 12, |
||
| 46 | 'day' => 1, |
||
| 47 | 'hour' => 0, |
||
| 48 | 'minute' => 0, |
||
| 49 | 'second' => 0, |
||
| 50 | ], $this->cal->prevMonth('array')); |
||
| 51 | } |
||
| 52 | |||
| 53 | public function testThisMonth() |
||
| 54 | { |
||
| 55 | $this->assertEqual(1, $this->cal->thisMonth()); |
||
| 56 | } |
||
| 57 | |||
| 58 | public function testNextMonth() |
||
| 59 | { |
||
| 60 | $this->assertEqual(2, $this->cal->nextMonth()); |
||
| 61 | } |
||
| 62 | |||
| 63 | public function testPrevDay() |
||
| 64 | { |
||
| 65 | $this->assertEqual(31, $this->cal->prevDay()); |
||
| 66 | } |
||
| 67 | |||
| 68 | public function testPrevDay_Array() |
||
| 69 | { |
||
| 70 | $this->assertEqual([ |
||
| 71 | 'year' => 2002, |
||
| 72 | 'month' => 12, |
||
| 73 | 'day' => 31, |
||
| 74 | 'hour' => 0, |
||
| 75 | 'minute' => 0, |
||
| 76 | 'second' => 0, |
||
| 77 | ], $this->cal->prevDay('array')); |
||
| 78 | } |
||
| 79 | |||
| 80 | public function testThisDay() |
||
| 81 | { |
||
| 82 | $this->assertEqual(1, $this->cal->thisDay()); |
||
| 83 | } |
||
| 84 | |||
| 85 | public function testNextDay() |
||
| 86 | { |
||
| 87 | $this->assertEqual(2, $this->cal->nextDay()); |
||
| 88 | } |
||
| 89 | |||
| 90 | public function testPrevHour() |
||
| 91 | { |
||
| 92 | $this->assertEqual(23, $this->cal->prevHour()); |
||
| 93 | } |
||
| 94 | |||
| 95 | public function testThisHour() |
||
| 96 | { |
||
| 97 | $this->assertEqual(0, $this->cal->thisHour()); |
||
| 98 | } |
||
| 99 | |||
| 100 | public function testNextHour() |
||
| 101 | { |
||
| 102 | $this->assertEqual(1, $this->cal->nextHour()); |
||
| 103 | } |
||
| 104 | |||
| 105 | public function testPrevMinute() |
||
| 106 | { |
||
| 107 | $this->assertEqual(59, $this->cal->prevMinute()); |
||
| 108 | } |
||
| 109 | |||
| 110 | public function testThisMinute() |
||
| 111 | { |
||
| 112 | $this->assertEqual(0, $this->cal->thisMinute()); |
||
| 113 | } |
||
| 114 | |||
| 115 | public function testNextMinute() |
||
| 116 | { |
||
| 117 | $this->assertEqual(1, $this->cal->nextMinute()); |
||
| 118 | } |
||
| 119 | |||
| 120 | public function testPrevSecond() |
||
| 121 | { |
||
| 122 | $this->assertEqual(59, $this->cal->prevSecond()); |
||
| 123 | } |
||
| 124 | |||
| 125 | public function testThisSecond() |
||
| 126 | { |
||
| 127 | $this->assertEqual(0, $this->cal->thisSecond()); |
||
| 128 | } |
||
| 129 | |||
| 130 | public function testNextSecond() |
||
| 131 | { |
||
| 132 | $this->assertEqual(1, $this->cal->nextSecond()); |
||
| 133 | } |
||
| 134 | |||
| 135 | public function testGetTimeStamp() |
||
| 136 | { |
||
| 137 | $stamp = mktime(0, 0, 0, 1, 1, 2003); |
||
| 138 | $this->assertEqual($stamp, $this->cal->getTimestamp()); |
||
| 139 | } |
||
| 140 | } |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Class TestOfYearBuild. |
||
| 144 | */ |
||
| 145 | class TestOfYearBuild extends TestOfYear |
||
| 146 | { |
||
| 147 | /** |
||
| 148 | * TestOfYearBuild constructor. |
||
| 149 | */ |
||
| 150 | public function __construct() |
||
| 151 | { |
||
| 152 | $this->UnitTestCase('Test of Year::build()'); |
||
| 153 | } |
||
| 154 | |||
| 155 | public function testSize() |
||
| 156 | { |
||
| 157 | $this->cal->build(); |
||
| 158 | $this->assertEqual(12, $this->cal->size()); |
||
| 159 | } |
||
| 160 | |||
| 161 | public function testFetch() |
||
| 162 | { |
||
| 163 | $this->cal->build(); |
||
| 164 | $i = 0; |
||
| 165 | while ($Child = $this->cal->fetch()) { |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 166 | ++$i; |
||
| 167 | } |
||
| 168 | $this->assertEqual(12, $i); |
||
| 169 | } |
||
| 170 | |||
| 171 | public function testFetchAll() |
||
| 172 | { |
||
| 173 | $this->cal->build(); |
||
| 174 | $children = []; |
||
| 175 | $i = 1; |
||
| 176 | while ($Child = $this->cal->fetch()) { |
||
| 177 | $children[$i] = $Child; |
||
| 178 | ++$i; |
||
| 179 | } |
||
| 180 | $this->assertEqual($children, $this->cal->fetchAll()); |
||
| 181 | } |
||
| 182 | |||
| 183 | public function testSelection() |
||
| 184 | { |
||
| 185 | require_once CALENDAR_ROOT . 'Month.php'; |
||
| 186 | $selection = [new Calendar_Month(2003, 10)]; |
||
| 187 | $this->cal->build($selection); |
||
| 188 | $i = 1; |
||
| 189 | while ($Child = $this->cal->fetch()) { |
||
| 190 | if (10 == $i) { |
||
| 191 | break; |
||
| 192 | } |
||
| 193 | ++$i; |
||
| 194 | } |
||
| 195 | $this->assertTrue($Child->isSelected()); |
||
| 196 | } |
||
| 197 | } |
||
| 198 | |||
| 199 | if (!defined('TEST_RUNNING')) { |
||
| 200 | define('TEST_RUNNING', true); |
||
| 201 | $test = new TestOfYear(); |
||
| 202 | $test->run(new HtmlReporter()); |
||
|
0 ignored issues
–
show
The type
HtmlReporter was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 203 | $test = new TestOfYearBuild(); |
||
| 204 | $test->run(new HtmlReporter()); |
||
| 205 | } |
||
| 206 |