@@ -61,22 +61,22 @@ public function testOnce()
61
61
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
62
62
63
63
$ this ->assertDatabaseCount ($ table , 1 );
64
- $ this ->assertDatabaseCount ($ this ->table , 11 );
64
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
65
65
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
66
66
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
67
67
68
68
$ this ->assertDatabaseCount ($ table , 2 );
69
- $ this ->assertDatabaseCount ($ this ->table , 11 );
69
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
70
70
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
71
71
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
72
72
73
73
$ this ->assertDatabaseCount ($ table , 3 );
74
- $ this ->assertDatabaseCount ($ this ->table , 11 );
74
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
75
75
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
76
76
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
77
77
78
78
$ this ->assertDatabaseCount ($ table , 4 );
79
- $ this ->assertDatabaseCount ($ this ->table , 11 );
79
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
80
80
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
81
81
}
82
82
@@ -141,7 +141,7 @@ public function testSingleEnvironment()
141
141
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
142
142
143
143
$ this ->assertDatabaseCount ($ table , 5 );
144
- $ this ->assertDatabaseCount ($ this ->table , 11 );
144
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
145
145
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
146
146
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
147
147
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -150,7 +150,7 @@ public function testSingleEnvironment()
150
150
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
151
151
152
152
$ this ->assertDatabaseCount ($ table , 5 );
153
- $ this ->assertDatabaseCount ($ this ->table , 11 );
153
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
154
154
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
155
155
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
156
156
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -178,7 +178,7 @@ public function testManyEnvironments()
178
178
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
179
179
180
180
$ this ->assertDatabaseCount ($ table , 5 );
181
- $ this ->assertDatabaseCount ($ this ->table , 11 );
181
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
182
182
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
183
183
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
184
184
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -189,7 +189,7 @@ public function testManyEnvironments()
189
189
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
190
190
191
191
$ this ->assertDatabaseCount ($ table , 5 );
192
- $ this ->assertDatabaseCount ($ this ->table , 11 );
192
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
193
193
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
194
194
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
195
195
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -214,13 +214,13 @@ public function testAllow()
214
214
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
215
215
216
216
$ this ->assertDatabaseCount ($ table , 5 );
217
- $ this ->assertDatabaseCount ($ this ->table , 11 );
217
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
218
218
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_allow ' );
219
219
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_disallow ' );
220
220
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
221
221
222
222
$ this ->assertDatabaseCount ($ table , 5 );
223
- $ this ->assertDatabaseCount ($ this ->table , 11 );
223
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
224
224
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_allow ' );
225
225
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_disallow ' );
226
226
}
@@ -239,7 +239,7 @@ public function testUpSuccess()
239
239
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
240
240
241
241
$ this ->assertDatabaseCount ($ table , 2 );
242
- $ this ->assertDatabaseCount ($ this ->table , 11 );
242
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
243
243
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_success ' );
244
244
}
245
245
@@ -257,7 +257,7 @@ public function testUpSuccessOnFailed()
257
257
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
258
258
259
259
$ this ->assertDatabaseCount ($ table , 2 );
260
- $ this ->assertDatabaseCount ($ this ->table , 11 );
260
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
261
261
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_success_on_failed ' );
262
262
263
263
try {
@@ -274,7 +274,7 @@ public function testUpSuccessOnFailed()
274
274
}
275
275
276
276
$ this ->assertDatabaseCount ($ table , 2 );
277
- $ this ->assertDatabaseCount ($ this ->table , 11 );
277
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
278
278
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_success_on_failed ' );
279
279
}
280
280
@@ -292,7 +292,7 @@ public function testUpFailed()
292
292
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
293
293
294
294
$ this ->assertDatabaseCount ($ table , 0 );
295
- $ this ->assertDatabaseCount ($ this ->table , 11 );
295
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
296
296
$ this ->assertDatabaseMigrationHas ($ this ->table , 'run_failed ' );
297
297
}
298
298
@@ -310,12 +310,9 @@ public function testUpFailedOnException()
310
310
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
311
311
312
312
$ this ->assertDatabaseCount ($ table , 0 );
313
- $ this ->assertDatabaseCount ($ this ->table , 11 );
313
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
314
314
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_failed_failure ' );
315
315
316
- $ this ->assertDatabaseCount ($ table , 0 );
317
- $ this ->assertDatabaseCount ($ this ->table , 11 );
318
-
319
316
try {
320
317
$ this ->copyFailedMethod ();
321
318
@@ -330,7 +327,7 @@ public function testUpFailedOnException()
330
327
}
331
328
332
329
$ this ->assertDatabaseCount ($ table , 0 );
333
- $ this ->assertDatabaseCount ($ this ->table , 11 );
330
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
334
331
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_failed_failure ' );
335
332
}
336
333
@@ -393,8 +390,8 @@ public function testPathAsDirectory()
393
390
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'baz ' );
394
391
$ this ->artisan (Names::MIGRATE , ['--path ' => $ path ])->assertExitCode (0 );
395
392
396
- $ this ->assertDatabaseCount ($ table , 1 );
397
- $ this ->assertDatabaseCount ($ this ->table , 1 );
393
+ $ this ->assertDatabaseCount ($ table , 2 );
394
+ $ this ->assertDatabaseCount ($ this ->table , 2 );
398
395
$ this ->assertDatabaseMigrationHas ($ this ->table , 'baz ' );
399
396
400
397
$ this ->assertSame ('sub_path/2021_12_15_205804_baz ' , $ this ->table ()->first ()->action );
@@ -426,13 +423,13 @@ public function testDisabledBefore()
426
423
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
427
424
428
425
$ this ->assertDatabaseCount ($ table , 2 );
429
- $ this ->assertDatabaseCount ($ this ->table , 11 );
426
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
430
427
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
431
428
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
432
429
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
433
430
434
431
$ this ->assertDatabaseCount ($ table , 2 );
435
- $ this ->assertDatabaseCount ($ this ->table , 11 );
432
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
436
433
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
437
434
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
438
435
}
@@ -452,13 +449,13 @@ public function testEnabledBefore()
452
449
$ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
453
450
454
451
$ this ->assertDatabaseCount ($ table , 1 );
455
- $ this ->assertDatabaseCount ($ this ->table , 10 );
452
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
456
453
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
457
454
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
458
455
$ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
459
456
460
457
$ this ->assertDatabaseCount ($ table , 1 );
461
- $ this ->assertDatabaseCount ($ this ->table , 10 );
458
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
462
459
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
463
460
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
464
461
}
@@ -478,25 +475,25 @@ public function testMixedBefore()
478
475
$ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
479
476
480
477
$ this ->assertDatabaseCount ($ table , 1 );
481
- $ this ->assertDatabaseCount ($ this ->table , 10 );
478
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
482
479
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
483
480
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
484
481
$ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
485
482
486
483
$ this ->assertDatabaseCount ($ table , 1 );
487
- $ this ->assertDatabaseCount ($ this ->table , 10 );
484
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
488
485
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
489
486
$ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
490
487
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
491
488
492
489
$ this ->assertDatabaseCount ($ table , 2 );
493
- $ this ->assertDatabaseCount ($ this ->table , 11 );
490
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
494
491
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
495
492
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
496
493
$ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
497
494
498
495
$ this ->assertDatabaseCount ($ table , 2 );
499
- $ this ->assertDatabaseCount ($ this ->table , 11 );
496
+ $ this ->assertDatabaseCount ($ this ->table , 12 );
500
497
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
501
498
$ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
502
499
}
@@ -560,4 +557,99 @@ public function testSorting(): void
560
557
561
558
$ this ->assertSame ($ files , $ records );
562
559
}
560
+
561
+ public function testDirectoryExclusion ()
562
+ {
563
+ $ this ->copyFiles ();
564
+
565
+ $ this ->app ['config ' ]->set ('actions.exclude ' , 'sub_path ' );
566
+
567
+ $ table = 'every_time ' ;
568
+
569
+ $ this ->artisan (Names::INSTALL )->assertExitCode (0 );
570
+
571
+ $ this ->assertDatabaseCount ($ table , 0 );
572
+ $ this ->assertDatabaseCount ($ this ->table , 0 );
573
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
574
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path ' );
575
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
576
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
577
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
578
+
579
+ $ this ->assertDatabaseCount ($ table , 1 );
580
+ $ this ->assertDatabaseCount ($ this ->table , 10 );
581
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
582
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path ' );
583
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
584
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
585
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
586
+
587
+ $ this ->assertDatabaseCount ($ table , 2 );
588
+ $ this ->assertDatabaseCount ($ this ->table , 10 );
589
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
590
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path ' );
591
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
592
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
593
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
594
+
595
+ $ this ->assertDatabaseCount ($ table , 3 );
596
+ $ this ->assertDatabaseCount ($ this ->table , 10 );
597
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
598
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path ' );
599
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
600
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
601
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
602
+
603
+ $ this ->assertDatabaseCount ($ table , 4 );
604
+ $ this ->assertDatabaseCount ($ this ->table , 10 );
605
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
606
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path ' );
607
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
608
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
609
+ }
610
+
611
+ public function testFileExclusion ()
612
+ {
613
+ $ this ->copyFiles ();
614
+
615
+ $ this ->app ['config ' ]->set ('actions.exclude ' , 'sub_path/2021_12_15_205804_baz ' );
616
+
617
+ $ table = 'every_time ' ;
618
+
619
+ $ this ->artisan (Names::INSTALL )->assertExitCode (0 );
620
+
621
+ $ this ->assertDatabaseCount ($ table , 0 );
622
+ $ this ->assertDatabaseCount ($ this ->table , 0 );
623
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
624
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
625
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
626
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
627
+
628
+ $ this ->assertDatabaseCount ($ table , 1 );
629
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
630
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
631
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
632
+ $ this ->assertDatabaseMigrationHas ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
633
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
634
+
635
+ $ this ->assertDatabaseCount ($ table , 2 );
636
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
637
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
638
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
639
+ $ this ->assertDatabaseMigrationHas ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
640
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
641
+
642
+ $ this ->assertDatabaseCount ($ table , 3 );
643
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
644
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
645
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
646
+ $ this ->assertDatabaseMigrationHas ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
647
+ $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
648
+
649
+ $ this ->assertDatabaseCount ($ table , 4 );
650
+ $ this ->assertDatabaseCount ($ this ->table , 11 );
651
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
652
+ $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'sub_path/2021_12_15_205804_baz ' );
653
+ $ this ->assertDatabaseMigrationHas ($ this ->table , 'sub_path/2022_10_27_230732_foo ' );
654
+ }
563
655
}
0 commit comments