@@ -34,6 +34,8 @@ final class MigrateStatusTest extends CIUnitTestCase
3434
3535 protected function setUp (): void
3636 {
37+ $ this ->resetServices ();
38+
3739 parent ::setUp ();
3840
3941 Database::connect ()->table ('migrations ' )->emptyTable ();
@@ -57,6 +59,8 @@ protected function setUp(): void
5759 );
5860 file_put_contents ($ this ->migrationFileTo , $ contents );
5961
62+ $ this ->resetServices ();
63+
6064 putenv ('NO_COLOR=1 ' );
6165 CLI ::init ();
6266 }
@@ -73,6 +77,8 @@ protected function tearDown(): void
7377
7478 putenv ('NO_COLOR ' );
7579 CLI ::init ();
80+
81+ $ this ->resetServices ();
7682 }
7783
7884 public function testMigrateAllWithWithTwoNamespaces (): void
@@ -82,19 +88,7 @@ public function testMigrateAllWithWithTwoNamespaces(): void
8288
8389 command ('migrate:status ' );
8490
85- $ result = str_replace (PHP_EOL , "\n" , $ this ->getStreamFilterBuffer ());
86- $ result = preg_replace ('/\d{4}-\d\d-\d\d \d\d:\d\d:\d\d/ ' , 'YYYY-MM-DD HH:MM:SS ' , $ result );
87- $ expected = <<<'EOL'
88- +---------------+-------------------+--------------------+-------+---------------------+-------+
89- | Namespace | Version | Filename | Group | Migrated On | Batch |
90- +---------------+-------------------+--------------------+-------+---------------------+-------+
91- | App | 2018-01-24-102301 | Some_migration | tests | YYYY-MM-DD HH:MM:SS | 1 |
92- | Tests\Support | 20160428212500 | Create_test_tables | tests | YYYY-MM-DD HH:MM:SS | 1 |
93- +---------------+-------------------+--------------------+-------+---------------------+-------+
94-
95-
96- EOL;
97- $ this ->assertSame ($ expected , $ result );
91+ $ this ->assertMigrationStatusHasAppAndSupportMigrations ();
9892 }
9993
10094 public function testMigrateWithWithTwoNamespaces (): void
@@ -105,18 +99,15 @@ public function testMigrateWithWithTwoNamespaces(): void
10599
106100 command ('migrate:status ' );
107101
108- $ result = str_replace (PHP_EOL , "\n" , $ this ->getStreamFilterBuffer ());
109- $ result = preg_replace ('/\d{4}-\d\d-\d\d \d\d:\d\d:\d\d/ ' , 'YYYY-MM-DD HH:MM:SS ' , $ result );
110- $ expected = <<<'EOL'
111- +---------------+-------------------+--------------------+-------+---------------------+-------+
112- | Namespace | Version | Filename | Group | Migrated On | Batch |
113- +---------------+-------------------+--------------------+-------+---------------------+-------+
114- | App | 2018-01-24-102301 | Some_migration | tests | YYYY-MM-DD HH:MM:SS | 1 |
115- | Tests\Support | 20160428212500 | Create_test_tables | tests | YYYY-MM-DD HH:MM:SS | 2 |
116- +---------------+-------------------+--------------------+-------+---------------------+-------+
102+ $ this ->assertMigrationStatusHasAppAndSupportMigrations ();
103+ }
117104
105+ private function assertMigrationStatusHasAppAndSupportMigrations (): void
106+ {
107+ $ result = str_replace (PHP_EOL , "\n" , $ this ->getStreamFilterBuffer ());
118108
119- EOL;
120- $ this ->assertSame ($ expected , $ result );
109+ $ this ->assertStringContainsString ('| App | 2018-01-24-102301 | Some_migration ' , $ result );
110+ $ this ->assertStringContainsString ('| Tests\Support | 20160428212500 ' , $ result );
111+ $ this ->assertStringContainsString ('Create_test_tables ' , $ result );
121112 }
122113}
0 commit comments