4
4
5
5
namespace System \Test \Integrate \Commands ;
6
6
7
+ use System \Database \MyPDO ;
7
8
use System \Database \MySchema \Table \Create ;
8
9
use System \Integrate \Application ;
9
10
use System \Integrate \Console \MigrationCommand ;
10
- use System \Support \Facades \PDO as FacadesPDO ;
11
+ use System \Support \Facades \Facade ;
11
12
use System \Support \Facades \Schema ;
13
+ use System \Test \Database \BaseConnection ;
12
14
use System \Text \Str ;
13
15
14
- final class MigrationCommandsTest extends \RealDatabaseConnectionTest
16
+ final class MigrationCommandsTest extends BaseConnection
15
17
{
16
18
private Application $ app ;
17
19
18
20
protected function setUp (): void
19
21
{
20
- parent ::setUp ();
22
+ $ this ->createConnection ();
23
+
21
24
$ this ->app = new Application (__DIR__ );
22
25
$ this ->app ->setMigrationPath ('/database/migration/ ' );
23
26
$ this ->app ->set ('environment ' , 'dev ' );
24
- new Schema ( $ this ->app );
25
- new FacadesPDO ( $ this ->app );
26
- $ this ->app ->set (\ System \ Database \MyPDO::class, $ this ->pdo );
27
- $ this -> app -> set ( ' MySchema ' , $ this -> schema );
28
- $ this -> app -> set ( ' dsn.sql ' , $ this ->env );
27
+ $ this -> app -> set (MyPDO::class, fn () => $ this ->pdo );
28
+ $ this -> app -> set ( ' MySchema ' , fn () => $ this ->schema );
29
+ $ this ->app ->set (' dsn.sql ' , fn () => $ this ->env );
30
+
31
+ Facade:: setFacadeBase ( $ this ->app );
29
32
Schema::table ('migration ' , function (Create $ column ) {
30
33
$ column ('migration ' )->varchar (100 )->notNull ();
31
34
$ column ('batch ' )->int (4 )->notNull ();
@@ -36,7 +39,7 @@ protected function setUp(): void
36
39
37
40
protected function tearDown (): void
38
41
{
39
- parent :: tearDown ();
42
+ $ this -> dropConnection ();
40
43
Schema::drop ()->table ('migartion ' )->ifExists ()->execute ();
41
44
MigrationCommand::flushVendorMigrationPaths ();
42
45
$ this ->app ->flush ();
@@ -158,7 +161,7 @@ public function itCanRunDatabaseShow()
158
161
$ out = ob_get_clean ();
159
162
160
163
$ this ->assertEquals (0 , $ exit );
161
- $ this ->assertTrue (Str::contains ($ out , 'users ' ));
164
+ $ this ->assertTrue (Str::contains ($ out , 'migration ' ));
162
165
}
163
166
164
167
/**
0 commit comments