diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index 8ddd9a98..41088eaa 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -1,6 +1,6 @@ name: Database -on: +on: push: paths: - ".github/workflows/database.yml" diff --git a/src/System/Integrate/Console/MigrationCommand.php b/src/System/Integrate/Console/MigrationCommand.php index 7b04562a..61ce50c0 100644 --- a/src/System/Integrate/Console/MigrationCommand.php +++ b/src/System/Integrate/Console/MigrationCommand.php @@ -502,6 +502,7 @@ public function databaseShow(): int } foreach ($tables as $table) { + $table = array_change_key_case($table); $name = $table['table_name']; $time = $table['create_time']; $size = $table['size']; diff --git a/tests/Integrate/Commands/MigrationCommandsTest.php b/tests/Integrate/Commands/MigrationCommandsTest.php index 322ba234..67efa8c3 100644 --- a/tests/Integrate/Commands/MigrationCommandsTest.php +++ b/tests/Integrate/Commands/MigrationCommandsTest.php @@ -4,28 +4,31 @@ namespace System\Test\Integrate\Commands; +use System\Database\MyPDO; use System\Database\MySchema\Table\Create; use System\Integrate\Application; use System\Integrate\Console\MigrationCommand; -use System\Support\Facades\PDO as FacadesPDO; +use System\Support\Facades\Facade; use System\Support\Facades\Schema; +use System\Test\Database\BaseConnection; use System\Text\Str; -final class MigrationCommandsTest extends \RealDatabaseConnectionTest +final class MigrationCommandsTest extends BaseConnection { private Application $app; protected function setUp(): void { - parent::setUp(); + $this->createConnection(); + $this->app = new Application(__DIR__); $this->app->setMigrationPath('/database/migration/'); $this->app->set('environment', 'dev'); - new Schema($this->app); - new FacadesPDO($this->app); - $this->app->set(\System\Database\MyPDO::class, $this->pdo); - $this->app->set('MySchema', $this->schema); - $this->app->set('dsn.sql', $this->env); + $this->app->set(MyPDO::class, fn () => $this->pdo); + $this->app->set('MySchema', fn () => $this->schema); + $this->app->set('dsn.sql', fn () => $this->env); + + Facade::setFacadeBase($this->app); Schema::table('migration', function (Create $column) { $column('migration')->varchar(100)->notNull(); $column('batch')->int(4)->notNull(); @@ -36,7 +39,7 @@ protected function setUp(): void protected function tearDown(): void { - parent::tearDown(); + $this->dropConnection(); Schema::drop()->table('migartion')->ifExists()->execute(); MigrationCommand::flushVendorMigrationPaths(); $this->app->flush(); @@ -158,7 +161,7 @@ public function itCanRunDatabaseShow() $out = ob_get_clean(); $this->assertEquals(0, $exit); - $this->assertTrue(Str::contains($out, 'users')); + $this->assertTrue(Str::contains($out, 'migration')); } /**