@@ -29,22 +29,23 @@ final class MigrationIntegrationTest extends CIUnitTestCase
2929 use DatabaseTestTrait;
3030 use StreamFilterTrait;
3131
32- protected $ migrateOnce = false ;
3332 private string $ migrationFileFrom = SUPPORTPATH . 'Database/Migrations/20160428212500_Create_test_tables.php ' ;
34- private string $ migrationFileTo = APPPATH . 'Database/Migrations/20160428212500_Create_test_tables .php ' ;
33+ private string $ migrationFileTo = APPPATH . 'Database/Migrations/20990101000000_Create_test_tables .php ' ;
3534
3635 protected function setUp (): void
3736 {
37+ if (is_file ($ this ->migrationFileTo )) {
38+ @unlink ($ this ->migrationFileTo );
39+ }
40+
41+ $ this ->resetServices ();
42+
3843 parent ::setUp ();
3944
4045 if (! is_file ($ this ->migrationFileFrom )) {
4146 $ this ->fail (clean_path ($ this ->migrationFileFrom ) . ' is not found. ' );
4247 }
4348
44- if (is_file ($ this ->migrationFileTo )) {
45- @unlink ($ this ->migrationFileTo );
46- }
47-
4849 copy ($ this ->migrationFileFrom , $ this ->migrationFileTo );
4950
5051 $ contents = file_get_contents ($ this ->migrationFileTo );
@@ -54,26 +55,28 @@ protected function setUp(): void
5455
5556 protected function tearDown (): void
5657 {
57- parent ::tearDown ();
58-
5958 if (is_file ($ this ->migrationFileTo )) {
6059 @unlink ($ this ->migrationFileTo );
6160 }
61+
62+ $ this ->resetServices ();
63+
64+ parent ::tearDown ();
6265 }
6366
6467 public function testMigrationWithRollbackHasSameNameFormat (): void
6568 {
6669 command ('migrate -n App ' );
6770 $ this ->assertStringContainsString (
68- '(App) 20160428212500_App \Database\Migrations\Migration_Create_test_tables ' ,
71+ '(App) 20990101000000_App \Database\Migrations\Migration_Create_test_tables ' ,
6972 $ this ->getStreamFilterBuffer (),
7073 );
7174
7275 $ this ->resetStreamFilterBuffer ();
7376
7477 command ('migrate:rollback -n App ' );
7578 $ this ->assertStringContainsString (
76- '(App) 20160428212500_App \Database\Migrations\Migration_Create_test_tables ' ,
79+ '(App) 20990101000000_App \Database\Migrations\Migration_Create_test_tables ' ,
7780 $ this ->getStreamFilterBuffer (),
7881 );
7982 }
0 commit comments