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