@@ -61,22 +61,22 @@ public function testOnce()
6161 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
6262
6363 $ this ->assertDatabaseCount ($ table , 1 );
64- $ this ->assertDatabaseCount ($ this ->table , 11 );
64+ $ this ->assertDatabaseCount ($ this ->table , 12 );
6565 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
6666 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
6767
6868 $ this ->assertDatabaseCount ($ table , 2 );
69- $ this ->assertDatabaseCount ($ this ->table , 11 );
69+ $ this ->assertDatabaseCount ($ this ->table , 12 );
7070 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
7171 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
7272
7373 $ this ->assertDatabaseCount ($ table , 3 );
74- $ this ->assertDatabaseCount ($ this ->table , 11 );
74+ $ this ->assertDatabaseCount ($ this ->table , 12 );
7575 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
7676 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
7777
7878 $ this ->assertDatabaseCount ($ table , 4 );
79- $ this ->assertDatabaseCount ($ this ->table , 11 );
79+ $ this ->assertDatabaseCount ($ this ->table , 12 );
8080 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , $ table );
8181 }
8282
@@ -141,7 +141,7 @@ public function testSingleEnvironment()
141141 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
142142
143143 $ this ->assertDatabaseCount ($ table , 5 );
144- $ this ->assertDatabaseCount ($ this ->table , 11 );
144+ $ this ->assertDatabaseCount ($ this ->table , 12 );
145145 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
146146 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
147147 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -150,7 +150,7 @@ public function testSingleEnvironment()
150150 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
151151
152152 $ this ->assertDatabaseCount ($ table , 5 );
153- $ this ->assertDatabaseCount ($ this ->table , 11 );
153+ $ this ->assertDatabaseCount ($ this ->table , 12 );
154154 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
155155 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
156156 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -178,7 +178,7 @@ public function testManyEnvironments()
178178 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
179179
180180 $ this ->assertDatabaseCount ($ table , 5 );
181- $ this ->assertDatabaseCount ($ this ->table , 11 );
181+ $ this ->assertDatabaseCount ($ this ->table , 12 );
182182 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
183183 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
184184 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -189,7 +189,7 @@ public function testManyEnvironments()
189189 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
190190
191191 $ this ->assertDatabaseCount ($ table , 5 );
192- $ this ->assertDatabaseCount ($ this ->table , 11 );
192+ $ this ->assertDatabaseCount ($ this ->table , 12 );
193193 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_all ' );
194194 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_on_production ' );
195195 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_on_testing ' );
@@ -214,13 +214,13 @@ public function testAllow()
214214 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
215215
216216 $ this ->assertDatabaseCount ($ table , 5 );
217- $ this ->assertDatabaseCount ($ this ->table , 11 );
217+ $ this ->assertDatabaseCount ($ this ->table , 12 );
218218 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_allow ' );
219219 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_disallow ' );
220220 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
221221
222222 $ this ->assertDatabaseCount ($ table , 5 );
223- $ this ->assertDatabaseCount ($ this ->table , 11 );
223+ $ this ->assertDatabaseCount ($ this ->table , 12 );
224224 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_allow ' );
225225 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_disallow ' );
226226 }
@@ -239,7 +239,7 @@ public function testUpSuccess()
239239 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
240240
241241 $ this ->assertDatabaseCount ($ table , 2 );
242- $ this ->assertDatabaseCount ($ this ->table , 11 );
242+ $ this ->assertDatabaseCount ($ this ->table , 12 );
243243 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_success ' );
244244 }
245245
@@ -257,7 +257,7 @@ public function testUpSuccessOnFailed()
257257 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
258258
259259 $ this ->assertDatabaseCount ($ table , 2 );
260- $ this ->assertDatabaseCount ($ this ->table , 11 );
260+ $ this ->assertDatabaseCount ($ this ->table , 12 );
261261 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_success_on_failed ' );
262262
263263 try {
@@ -274,7 +274,7 @@ public function testUpSuccessOnFailed()
274274 }
275275
276276 $ this ->assertDatabaseCount ($ table , 2 );
277- $ this ->assertDatabaseCount ($ this ->table , 11 );
277+ $ this ->assertDatabaseCount ($ this ->table , 12 );
278278 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_success_on_failed ' );
279279 }
280280
@@ -292,7 +292,7 @@ public function testUpFailed()
292292 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
293293
294294 $ this ->assertDatabaseCount ($ table , 0 );
295- $ this ->assertDatabaseCount ($ this ->table , 11 );
295+ $ this ->assertDatabaseCount ($ this ->table , 12 );
296296 $ this ->assertDatabaseMigrationHas ($ this ->table , 'run_failed ' );
297297 }
298298
@@ -310,12 +310,9 @@ public function testUpFailedOnException()
310310 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
311311
312312 $ this ->assertDatabaseCount ($ table , 0 );
313- $ this ->assertDatabaseCount ($ this ->table , 11 );
313+ $ this ->assertDatabaseCount ($ this ->table , 12 );
314314 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_failed_failure ' );
315315
316- $ this ->assertDatabaseCount ($ table , 0 );
317- $ this ->assertDatabaseCount ($ this ->table , 11 );
318-
319316 try {
320317 $ this ->copyFailedMethod ();
321318
@@ -330,7 +327,7 @@ public function testUpFailedOnException()
330327 }
331328
332329 $ this ->assertDatabaseCount ($ table , 0 );
333- $ this ->assertDatabaseCount ($ this ->table , 11 );
330+ $ this ->assertDatabaseCount ($ this ->table , 12 );
334331 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'run_failed_failure ' );
335332 }
336333
@@ -393,8 +390,8 @@ public function testPathAsDirectory()
393390 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'baz ' );
394391 $ this ->artisan (Names::MIGRATE , ['--path ' => $ path ])->assertExitCode (0 );
395392
396- $ this ->assertDatabaseCount ($ table , 1 );
397- $ this ->assertDatabaseCount ($ this ->table , 1 );
393+ $ this ->assertDatabaseCount ($ table , 2 );
394+ $ this ->assertDatabaseCount ($ this ->table , 2 );
398395 $ this ->assertDatabaseMigrationHas ($ this ->table , 'baz ' );
399396
400397 $ this ->assertSame ('sub_path/2021_12_15_205804_baz ' , $ this ->table ()->first ()->action );
@@ -426,13 +423,13 @@ public function testDisabledBefore()
426423 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
427424
428425 $ this ->assertDatabaseCount ($ table , 2 );
429- $ this ->assertDatabaseCount ($ this ->table , 11 );
426+ $ this ->assertDatabaseCount ($ this ->table , 12 );
430427 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
431428 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
432429 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
433430
434431 $ this ->assertDatabaseCount ($ table , 2 );
435- $ this ->assertDatabaseCount ($ this ->table , 11 );
432+ $ this ->assertDatabaseCount ($ this ->table , 12 );
436433 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
437434 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
438435 }
@@ -452,13 +449,13 @@ public function testEnabledBefore()
452449 $ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
453450
454451 $ this ->assertDatabaseCount ($ table , 1 );
455- $ this ->assertDatabaseCount ($ this ->table , 10 );
452+ $ this ->assertDatabaseCount ($ this ->table , 11 );
456453 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
457454 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
458455 $ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
459456
460457 $ this ->assertDatabaseCount ($ table , 1 );
461- $ this ->assertDatabaseCount ($ this ->table , 10 );
458+ $ this ->assertDatabaseCount ($ this ->table , 11 );
462459 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
463460 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
464461 }
@@ -478,25 +475,25 @@ public function testMixedBefore()
478475 $ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
479476
480477 $ this ->assertDatabaseCount ($ table , 1 );
481- $ this ->assertDatabaseCount ($ this ->table , 10 );
478+ $ this ->assertDatabaseCount ($ this ->table , 11 );
482479 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
483480 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
484481 $ this ->artisan (Names::MIGRATE , ['--before ' => true ])->assertExitCode (0 );
485482
486483 $ this ->assertDatabaseCount ($ table , 1 );
487- $ this ->assertDatabaseCount ($ this ->table , 10 );
484+ $ this ->assertDatabaseCount ($ this ->table , 11 );
488485 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
489486 $ this ->assertDatabaseMigrationDoesntLike ($ this ->table , 'test_before_disabled ' );
490487 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
491488
492489 $ this ->assertDatabaseCount ($ table , 2 );
493- $ this ->assertDatabaseCount ($ this ->table , 11 );
490+ $ this ->assertDatabaseCount ($ this ->table , 12 );
494491 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
495492 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
496493 $ this ->artisan (Names::MIGRATE )->assertExitCode (0 );
497494
498495 $ this ->assertDatabaseCount ($ table , 2 );
499- $ this ->assertDatabaseCount ($ this ->table , 11 );
496+ $ this ->assertDatabaseCount ($ this ->table , 12 );
500497 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_enabled ' );
501498 $ this ->assertDatabaseMigrationHas ($ this ->table , 'test_before_disabled ' );
502499 }
@@ -560,4 +557,99 @@ public function testSorting(): void
560557
561558 $ this ->assertSame ($ files , $ records );
562559 }
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+ }
563655}
0 commit comments