[TASK] typo3/testing-framework 1.1 brings phpunit 6.2
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / Tests / Unit / CronCommand / NormalizeCommandTest.php
1 <?php
2 namespace TYPO3\CMS\Scheduler\Tests\Unit\CronCommand;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand;
18 use TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy;
19
20 /**
21 * Test case
22 */
23 class NormalizeCommandTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
24 {
25 /**
26 * @return array
27 */
28 public static function normalizeValidDataProvider()
29 {
30 return [
31 '@weekly' => ['@weekly', '0 0 * * 7'],
32 ' @weekly ' => [' @weekly ', '0 0 * * 7'],
33 '* * * * *' => ['* * * * *', '* * * * *'],
34 '30 4 1,15 * 5' => ['30 4 1,15 * 5', '30 4 1,15 * 5'],
35 '5 0 * * *' => ['5 0 * * *', '5 0 * * *'],
36 '15 14 1 * *' => ['15 14 1 * *', '15 14 1 * *'],
37 '0 22 * * 1-5' => ['0 22 * * 1-5', '0 22 * * 1,2,3,4,5'],
38 '23 0-23/2 * * *' => ['23 0-23/2 * * *', '23 0,2,4,6,8,10,12,14,16,18,20,22 * * *'],
39 '5 4 * * sun' => ['5 4 * * sun', '5 4 * * 7'],
40 '0-3/2,7 0,4 20-22, feb,mar-jun/2,7 1-3,sun' => [
41 '0-3/2,7 0,4 20-22 feb,mar-jun/2,7 1-3,sun',
42 '0,2,7 0,4 20,21,22 2,3,5,7 1,2,3,7'
43 ],
44 '0-20/10 * * * *' => ['0-20/10 * * * *', '0,10,20 * * * *'],
45 '* * 2 * *' => ['* * 2 * *', '* * 2 * *'],
46 '* * 2,7 * *' => ['* * 2,7 * *', '* * 2,7 * *'],
47 '* * 2-4,10 * *' => ['* * 2-4,10 * *', '* * 2,3,4,10 * *'],
48 '* * */14 * *' => ['* * */14 * *', '* * 1,15,29 * *'],
49 '* * 2,4-6/2,*/14 * *' => ['* * 2,4-6/2,*/14 * *', '* * 1,2,4,6,15,29 * *'],
50 '* * * * 1' => ['* * * * 1', '* * * * 1'],
51 '0 0 * * 0' => ['0 0 * * 0', '0 0 * * 7'],
52 '0 0 * * 7' => ['0 0 * * 7', '0 0 * * 7'],
53 '* * 1,2 * 1' => ['* * 1,2 * 1', '* * 1,2 * 1']
54 ];
55 }
56
57 /**
58 * @test
59 * @dataProvider normalizeValidDataProvider
60 * @param string $expression Cron command to test
61 * @param string $expected Expected result (normalized cron command syntax)
62 */
63 public function normalizeConvertsCronCommand($expression, $expected)
64 {
65 $result = NormalizeCommand::normalize($expression);
66 $this->assertEquals($expected, $result);
67 }
68
69 /**
70 * @return array
71 */
72 public static function validSpecialKeywordsDataProvider()
73 {
74 return [
75 '@yearly' => ['@yearly', '0 0 1 1 *'],
76 '@annually' => ['@annually', '0 0 1 1 *'],
77 '@monthly' => ['@monthly', '0 0 1 * *'],
78 '@weekly' => ['@weekly', '0 0 * * 0'],
79 '@daily' => ['@daily', '0 0 * * *'],
80 '@midnight' => ['@midnight', '0 0 * * *'],
81 '@hourly' => ['@hourly', '0 * * * *']
82 ];
83 }
84
85 /**
86 * @test
87 * @dataProvider validSpecialKeywordsDataProvider
88 * @param string $keyword Cron command keyword
89 * @param string $expectedCronCommand Expected result (normalized cron command syntax)
90 */
91 public function convertKeywordsToCronCommandConvertsValidKeywords($keyword, $expectedCronCommand)
92 {
93 $result = NormalizeCommandAccessibleProxy::convertKeywordsToCronCommand($keyword);
94 $this->assertEquals($expectedCronCommand, $result);
95 }
96
97 /**
98 * @test
99 */
100 public function convertKeywordsToCronCommandReturnsUnchangedCommandIfKeywordWasNotFound()
101 {
102 $invalidKeyword = 'foo';
103 $result = NormalizeCommandAccessibleProxy::convertKeywordsToCronCommand($invalidKeyword);
104 $this->assertEquals($invalidKeyword, $result);
105 }
106
107 /**
108 * @return array
109 */
110 public function normalizeFieldsValidDataProvider()
111 {
112 return [
113 '1-2 * * * *' => ['1-2 * * * *', '1,2 * * * *'],
114 '* 1-2 * * *' => ['* 1-2 * * *', '* 1,2 * * *'],
115 '* * 1-2 * *' => ['* * 1-2 * *', '* * 1,2 * *'],
116 '* * * 1-2 *' => ['* * * 1-2 *', '* * * 1,2 *'],
117 '* * * * 1-2' => ['* * * * 1-2', '* * * * 1,2']
118 ];
119 }
120
121 /**
122 * @test
123 * @dataProvider normalizeFieldsValidDataProvider
124 * @param string $expression Cron command to normalize
125 * @param string $expected Expected result (normalized cron command syntax)
126 */
127 public function normalizeFieldsConvertsField($expression, $expected)
128 {
129 $result = NormalizeCommandAccessibleProxy::normalizeFields($expression);
130 $this->assertEquals($expected, $result);
131 }
132
133 /**
134 * @return array
135 */
136 public static function normalizeMonthAndWeekdayFieldValidDataProvider()
137 {
138 return [
139 '* monthField' => ['*', true, '*'],
140 'string 1 monthField' => ['1', true, '1'],
141 'jan' => ['jan', true, '1'],
142 'feb/2' => ['feb/2', true, '2'],
143 'jan-feb/2' => ['jan-feb/2', true, '1'],
144 '1-2 monthField' => ['1-2', true, '1,2'],
145 '1-3/2,feb,may,6' => ['1-3/2,feb,may,6', true, '1,2,3,5,6'],
146 '*/4' => ['*/4', true, '1,5,9'],
147 '* !monthField' => ['*', false, '*'],
148 'string 1, !monthField' => ['1', false, '1'],
149 'fri' => ['fri', false, '5'],
150 'sun' => ['sun', false, '7'],
151 'string 0 for sunday' => ['0', false, '7'],
152 '0,1' => ['0,1', false, '1,7'],
153 '*/3' => ['*/3', false, '1,4,7'],
154 'tue/2' => ['tue/2', false, '2'],
155 '1-2 !monthField' => ['1-2', false, '1,2'],
156 'tue-fri/2' => ['tue-fri/2', false, '2,4'],
157 '1-3/2,tue,fri,6' => ['1-3/2,tue,fri,6', false, '1,2,3,5,6']
158 ];
159 }
160
161 /**
162 * @test
163 * @dataProvider normalizeMonthAndWeekdayFieldValidDataProvider
164 * @param string $expression Cron command partial expression for month and weekday fields
165 * @param bool $isMonthField Flag to designate month field or not
166 * @param string $expected Expected result (normalized months or weekdays)
167 */
168 public function normalizeMonthAndWeekdayFieldReturnsNormalizedListForValidExpression(
169 $expression,
170 $isMonthField,
171 $expected
172 ) {
173 $result = NormalizeCommandAccessibleProxy::normalizeMonthAndWeekdayField($expression, $isMonthField);
174 $this->assertSame($expected, $result);
175 }
176
177 /**
178 * @return array
179 */
180 public static function normalizeMonthAndWeekdayFieldInvalidDataProvider()
181 {
182 return [
183 'mon' => ['mon', true, 1291083486],
184 '1-2/mon' => ['1-2/mon', true, 1291414957],
185 '0,1' => ['0,1', true, 1291083486],
186 'feb' => ['feb', false, 1291163589],
187 '1-2/feb' => ['1-2/feb', false, 1291414957],
188 '0-fri/2,7' => ['0-fri/2,7', false, 1291237145]
189 ];
190 }
191
192 /**
193 * @test
194 * @dataProvider normalizeMonthAndWeekdayFieldInvalidDataProvider
195 * @param string $expression Cron command partial expression for month and weekday fields (invalid)
196 * @param bool $isMonthField Flag to designate month field or not
197 * @param int $expectedExceptionCode Expected exception code from provider
198 */
199 public function normalizeMonthAndWeekdayFieldThrowsExceptionForInvalidExpression(
200 $expression,
201 $isMonthField,
202 $expectedExceptionCode
203 ) {
204 $this->expectException(\InvalidArgumentException::class);
205 $this->expectExceptionCode($expectedExceptionCode);
206 NormalizeCommandAccessibleProxy::normalizeMonthAndWeekdayField($expression, $isMonthField);
207 }
208
209 /**
210 * @return array
211 */
212 public static function normalizeIntegerFieldValidDataProvider()
213 {
214 return [
215 '*' => ['*', '*'],
216 'string 2' => ['2', '2'],
217 'integer 3' => [3, '3'],
218 'list of values' => ['1,2,3', '1,2,3'],
219 'unsorted list of values' => ['3,1,5', '1,3,5'],
220 'duplicate values' => ['0-2/2,2', '0,2'],
221 'additional field between steps' => ['1-3/2,2', '1,2,3'],
222 '2-4' => ['2-4', '2,3,4'],
223 'simple step 4/4' => ['4/4', '4'],
224 'step 2-7/5' => ['2-7/5', '2,7'],
225 'steps 4-12/4' => ['4-12/4', '4,8,12'],
226 '0-59/20' => ['0-59/20', '0,20,40'],
227 '*/20' => ['*/20', '0,20,40']
228 ];
229 }
230
231 /**
232 * @test
233 * @dataProvider normalizeIntegerFieldValidDataProvider
234 * @param string $expression Cron command partial integer expression
235 * @param string $expected Expected result (normalized integer or integer list)
236 */
237 public function normalizeIntegerFieldReturnsNormalizedListForValidExpression($expression, $expected)
238 {
239 $result = NormalizeCommandAccessibleProxy::normalizeIntegerField($expression);
240 $this->assertSame($expected, $result);
241 }
242
243 /**
244 * @return array
245 */
246 public static function normalizeIntegerFieldInvalidDataProvider()
247 {
248 return [
249 'string foo' => ['foo', 0, 59, 1291429389],
250 'empty string' => ['', 0, 59, 1291429389],
251 '4-3' => ['4-3', 0, 59, 1291237145],
252 '/2' => ['/2', 0, 59, 1291234985],
253 '/' => ['/', 0, 59, 1291234985],
254 'left bound too low' => ['2-4', 3, 4, 1291470084],
255 'right bound too high' => ['2-4', 2, 3, 1291470170],
256 'left and right bound' => ['2-5', 2, 4, 1291470170],
257 'element in list is lower than allowed' => ['2,1,4', 2, 4, 1291470084],
258 'element in list is higher than allowed' => ['2,5,4', 1, 4, 1291470170]
259 ];
260 }
261
262 /**
263 * @test
264 * @dataProvider normalizeIntegerFieldInvalidDataProvider
265 * @param string $expression Cron command partial integer expression (invalid)
266 * @param int $lowerBound Lower limit
267 * @param int $upperBound Upper limit
268 * @param int $expectedExceptionCode Expected exception code
269 */
270 public function normalizeIntegerFieldThrowsExceptionForInvalidExpressions(
271 $expression,
272 $lowerBound,
273 $upperBound,
274 $expectedExceptionCode
275 ) {
276 $this->expectException(\InvalidArgumentException::class);
277 $this->expectExceptionCode($expectedExceptionCode);
278
279 NormalizeCommandAccessibleProxy::normalizeIntegerField($expression, $lowerBound, $upperBound);
280 }
281
282 /**
283 * @test
284 */
285 public function splitFieldsReturnsIntegerArrayWithFieldsSplitByWhitespace()
286 {
287 $result = NormalizeCommandAccessibleProxy::splitFields('12,13 * 1-12/2,14 jan fri');
288 $expectedResult = [
289 0 => '12,13',
290 1 => '*',
291 2 => '1-12/2,14',
292 3 => 'jan',
293 4 => 'fri'
294 ];
295 $this->assertSame($expectedResult, $result);
296 }
297
298 /**
299 * @return array
300 */
301 public static function invalidCronCommandFieldsDataProvider()
302 {
303 return [
304 'empty string' => [''],
305 'foo' => ['foo'],
306 'integer 4' => [4],
307 'four fields' => ['* * * *'],
308 'six fields' => ['* * * * * *']
309 ];
310 }
311
312 /**
313 * @test
314 * @dataProvider invalidCronCommandFieldsDataProvider
315 * @param string $cronCommand Invalid cron command
316 */
317 public function splitFieldsThrowsExceptionIfCronCommandDoesNotContainFiveFields($cronCommand)
318 {
319 $this->expectException(\InvalidArgumentException::class);
320 $this->expectExceptionCode(1291227373);
321 NormalizeCommandAccessibleProxy::splitFields($cronCommand);
322 }
323
324 /**
325 * @return array
326 */
327 public static function validRangeDataProvider()
328 {
329 return [
330 'single value' => ['3', '3'],
331 'integer 3' => [3, '3'],
332 '0-0' => ['0-0', '0'],
333 '4-4' => ['4-4', '4'],
334 '0-3' => ['0-3', '0,1,2,3'],
335 '4-5' => ['4-5', '4,5']
336 ];
337 }
338
339 /**
340 * @test
341 * @dataProvider validRangeDataProvider
342 * @param string $range Cron command range expression
343 * @param string $expected Expected result (normalized range)
344 */
345 public function convertRangeToListOfValuesReturnsCorrectListForValidRanges($range, $expected)
346 {
347 $result = NormalizeCommandAccessibleProxy::convertRangeToListOfValues($range);
348 $this->assertSame($expected, $result);
349 }
350
351 /**
352 * @return array
353 */
354 public static function invalidRangeDataProvider()
355 {
356 return [
357 'empty string' => ['', 1291234985],
358 'string' => ['foo', 1291237668],
359 'single dash' => ['-', 1291237668],
360 'left part is string' => ['foo-5', 1291237668],
361 'right part is string' => ['5-foo', 1291237668],
362 'range of strings' => ['foo-bar', 1291237668],
363 'string five minus' => ['5-', 1291237668],
364 'string minus five' => ['-5', 1291237668],
365 'more than one dash' => ['2-3-4', 1291234986],
366 'left part bigger than right part' => ['6-3', 1291237145]
367 ];
368 }
369
370 /**
371 * @test
372 * @dataProvider invalidRangeDataProvider
373 * @param string $range Cron command range expression (invalid)
374 * @param int $expectedExceptionCode Expected exception code from provider
375 */
376 public function convertRangeToListOfValuesThrowsExceptionForInvalidRanges($range, $expectedExceptionCode)
377 {
378 $this->expectException(\InvalidArgumentException::class);
379 $this->expectExceptionCode($expectedExceptionCode);
380 NormalizeCommandAccessibleProxy::convertRangeToListOfValues($range);
381 }
382
383 /**
384 * @return array
385 */
386 public static function validStepsDataProvider()
387 {
388 return [
389 '2/2' => ['2/2', '2'],
390 '2,3,4/2' => ['2,3,4/2', '2,4'],
391 '1,2,3,4,5,6,7/3' => ['1,2,3,4,5,6,7/3', '1,4,7'],
392 '0,1,2,3,4,5,6/3' => ['0,1,2,3,4,5,6/3', '0,3,6']
393 ];
394 }
395
396 /**
397 * @test
398 * @dataProvider validStepsDataProvider
399 * @param string $stepExpression Cron command step expression
400 * @param string $expected Expected result (normalized range)
401 */
402 public function reduceListOfValuesByStepValueReturnsCorrectListOfValues($stepExpression, $expected)
403 {
404 $result = NormalizeCommandAccessibleProxy::reduceListOfValuesByStepValue($stepExpression);
405 $this->assertSame($expected, $result);
406 }
407
408 /**
409 * @return array
410 */
411 public static function invalidStepsDataProvider()
412 {
413 return [
414 'empty string' => ['', 1291234987],
415 'slash only' => ['/', 1291414955],
416 'left part empty' => ['/2', 1291414955],
417 'right part empty' => ['2/', 1291414956],
418 'multiples slashes' => ['1/2/3', 1291242168],
419 '2-2' => ['2-2', 1291414956],
420 '2.3/2' => ['2.3/2', 1291414958],
421 '2,3,4/2.3' => ['2,3,4/2.3', 1291414957],
422 '2,3,4/2,3' => ['2,3,4/2,3', 1291414957]
423 ];
424 }
425
426 /**
427 * @test
428 * @dataProvider invalidStepsDataProvider
429 * @param string $stepExpression Cron command step expression (invalid)
430 * @param int $expectedExceptionCode Expected exception code
431 */
432 public function reduceListOfValuesByStepValueThrowsExceptionForInvalidStepExpressions(
433 $stepExpression,
434 $expectedExceptionCode
435 ) {
436 $this->expectException(\InvalidArgumentException::class);
437 $this->expectExceptionCode($expectedExceptionCode);
438
439 NormalizeCommandAccessibleProxy::reduceListOfValuesByStepValue($stepExpression);
440 }
441
442 /**
443 * @test
444 */
445 public function normalizeMonthAndWeekdayNormalizesAMonth()
446 {
447 $result = NormalizeCommandAccessibleProxy::normalizeMonthAndWeekday('feb', true);
448 $this->assertSame('2', $result);
449 }
450
451 /**
452 * @test
453 */
454 public function normalizeMonthAndWeekdayNormalizesAWeekday()
455 {
456 $result = NormalizeCommandAccessibleProxy::normalizeMonthAndWeekday('fri', false);
457 $this->assertSame('5', $result);
458 }
459
460 /**
461 * @test
462 */
463 public function normalizeMonthAndWeekdayLeavesValueUnchanged()
464 {
465 $result = NormalizeCommandAccessibleProxy::normalizeMonthAndWeekday('2');
466 $this->assertSame('2', $result);
467 }
468
469 /**
470 * @return array
471 */
472 public static function validMonthNamesDataProvider()
473 {
474 return [
475 'jan' => ['jan', 1],
476 'feb' => ['feb', 2],
477 'MaR' => ['MaR', 3],
478 'aPr' => ['aPr', 4],
479 'MAY' => ['MAY', 5],
480 'jun' => ['jun', 6],
481 'jul' => ['jul', 7],
482 'aug' => ['aug', 8],
483 'sep' => ['sep', 9],
484 'oct' => ['oct', 10],
485 'nov' => ['nov', 11],
486 'dec' => ['dec', 12],
487 'string 7' => ['7', 7],
488 'integer 7' => [7, 7],
489 'string 07' => ['07', 7],
490 'integer 07' => [7, 7]
491 ];
492 }
493
494 /**
495 * @test
496 * @dataProvider validMonthNamesDataProvider
497 * @param string $monthName Month name
498 * @param int $expectedInteger Number of the month
499 */
500 public function normalizeMonthConvertsName($monthName, $expectedInteger)
501 {
502 $result = NormalizeCommandAccessibleProxy::normalizeMonth($monthName);
503 $this->assertEquals($expectedInteger, $result);
504 }
505
506 /**
507 * @test
508 * @dataProvider validMonthNamesDataProvider
509 * @param string $monthName Month name
510 * @param int $expectedInteger Number of the month (not used)
511 */
512 public function normalizeMonthReturnsInteger($monthName, $expectedInteger)
513 {
514 $result = NormalizeCommandAccessibleProxy::normalizeMonth($monthName);
515 $this->assertInternalType(\PHPUnit\Framework\Constraint\IsType::TYPE_INT, $result);
516 }
517
518 /**
519 * @return array
520 */
521 public static function invalidMonthNamesDataProvider()
522 {
523 return [
524 'sep-' => ['sep-', 1291083486],
525 '-September-' => ['-September-', 1291083486],
526 ',sep' => [',sep', 1291083486],
527 ',September,' => [',September,', 1291083486],
528 'sep/' => ['sep/', 1291083486],
529 '/sep' => ['/sep', 1291083486],
530 '/September/' => ['/September/', 1291083486],
531 'foo' => ['foo', 1291083486],
532 'Tuesday' => ['Tuesday', 1291083486],
533 'Tue' => ['Tue', 1291083486],
534 'string 0' => ['0', 1291083486],
535 'integer 0' => [0, 1291083486],
536 'string seven' => ['seven', 1291083486],
537 'string 13' => ['13', 1291083486],
538 'integer 13' => [13, 1291083486],
539 'integer 100' => [100, 1291083486],
540 'integer 2010' => [2010, 1291083486],
541 'string minus 7' => ['-7', 1291083486],
542 'negative integer 7' => [-7, 1291083486]
543 ];
544 }
545
546 /**
547 * @test
548 * @dataProvider invalidMonthNamesDataProvider
549 * @param string $invalidMonthName Month name (invalid)
550 * @param int $expectedExceptionCode Expected exception code
551 */
552 public function normalizeMonthThrowsExceptionForInvalidMonthRepresentation(
553 $invalidMonthName,
554 $expectedExceptionCode
555 ) {
556 $this->expectException(\InvalidArgumentException::class);
557 $this->expectExceptionCode($expectedExceptionCode);
558
559 NormalizeCommandAccessibleProxy::normalizeMonth($invalidMonthName);
560 }
561
562 /**
563 * @return array
564 */
565 public static function validWeekdayDataProvider()
566 {
567 return [
568 'string 1' => ['1', 1],
569 'string 2' => ['2', 2],
570 'string 02' => ['02', 2],
571 'integer 02' => [2, 2],
572 'string 3' => ['3', 3],
573 'string 4' => ['4', 4],
574 'string 5' => ['5', 5],
575 'integer 5' => [5, 5],
576 'string 6' => ['6', 6],
577 'string 7' => ['7', 7],
578 'string 0' => ['0', 7],
579 'integer 0' => [0, 7],
580 'mon' => ['mon', 1],
581 'monday' => ['monday', 1],
582 'tue' => ['tue', 2],
583 'tuesday' => ['tuesday', 2],
584 'WED' => ['WED', 3],
585 'WEDnesday' => ['WEDnesday', 3],
586 'tHu' => ['tHu', 4],
587 'Thursday' => ['Thursday', 4],
588 'fri' => ['fri', 5],
589 'friday' => ['friday', 5],
590 'sat' => ['sat', 6],
591 'saturday' => ['saturday', 6],
592 'sun' => ['sun', 7],
593 'sunday' => ['sunday', 7]
594 ];
595 }
596
597 /**
598 * @test
599 * @dataProvider validWeekdayDataProvider
600 * @param string $weekday Weekday expression
601 * @param int $expectedInteger Number of weekday
602 */
603 public function normalizeWeekdayConvertsName($weekday, $expectedInteger)
604 {
605 $result = NormalizeCommandAccessibleProxy::normalizeWeekday($weekday);
606 $this->assertEquals($expectedInteger, $result);
607 }
608
609 /**
610 * @test
611 * @dataProvider validWeekdayDataProvider
612 * @param string $weekday Weekday expression
613 * @param int $expectedInteger Number of weekday (not used)
614 */
615 public function normalizeWeekdayReturnsInteger($weekday, $expectedInteger)
616 {
617 $result = NormalizeCommandAccessibleProxy::normalizeWeekday($weekday);
618 $this->assertInternalType(\PHPUnit\Framework\Constraint\IsType::TYPE_INT, $result);
619 }
620
621 /**
622 * @return array
623 */
624 public static function invalidWeekdayDataProvider()
625 {
626 return [
627 '-fri' => ['-fri'],
628 'fri-' => ['fri-'],
629 '-friday-' => ['-friday-'],
630 '/fri' => ['/fri'],
631 'fri/' => ['fri/'],
632 '/friday/' => ['/friday/'],
633 ',fri' => [',fri'],
634 ',friday,' => [',friday,'],
635 'string minus 1' => ['-1'],
636 'integer -1' => [-1],
637 'string seven' => ['seven'],
638 'string 8' => ['8'],
639 'string 29' => ['29'],
640 'string 2010' => ['2010'],
641 'Jan' => ['Jan'],
642 'January' => ['January'],
643 'MARCH' => ['MARCH']
644 ];
645 }
646
647 /**
648 * @test
649 * @dataProvider invalidWeekdayDataProvider
650 * @param string $weekday Weekday expression (invalid)
651 */
652 public function normalizeWeekdayThrowsExceptionForInvalidWeekdayRepresentation($weekday)
653 {
654 $this->expectException(\InvalidArgumentException::class);
655 $this->expectExceptionCode(1291163589);
656
657 NormalizeCommandAccessibleProxy::normalizeWeekday($weekday);
658 }
659 }