From db45e7e7b11c394ee21d573325898476804d8015 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 12 Apr 2024 23:36:51 -0400 Subject: [PATCH] Fix errors. --- psalm-baseline.xml | 5 +++++ src/Migration/Manager.php | 8 ++++---- tests/TestCase/Command/Phinx/StatusTest.php | 8 ++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8fe48c1d..3e399791 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -132,6 +132,11 @@ $executedVersion + + + ConfigurationTrait + + ConfigurationTrait diff --git a/src/Migration/Manager.php b/src/Migration/Manager.php index 9d39f9ec..d0df7b06 100644 --- a/src/Migration/Manager.php +++ b/src/Migration/Manager.php @@ -852,8 +852,8 @@ function ($phpFile) { $config = $this->getConfig(); $input = new ArrayInput([ - '--plugin' => $config['plugin'], - '--source' => $config['source'], + '--plugin' => $config['plugin'] ?? null, + '--source' => $config['source'] ?? null, '--connection' => $config->getConnection(), ]); $output = new OutputAdapter($io); @@ -971,9 +971,9 @@ public function getSeeds(): array new InputOption('source', mode: InputOption::VALUE_OPTIONAL, default: ''), ]); $input = new ArrayInput([ - '--plugin' => $config['plugin'], + '--plugin' => $config['plugin'] ?? null, + '--source' => $config['source'] ?? null, '--connection' => $config->getConnection(), - '--source' => $config['source'], ], $optionDef); $output = new OutputAdapter($this->io); diff --git a/tests/TestCase/Command/Phinx/StatusTest.php b/tests/TestCase/Command/Phinx/StatusTest.php index 22e8fd3e..97f493d9 100644 --- a/tests/TestCase/Command/Phinx/StatusTest.php +++ b/tests/TestCase/Command/Phinx/StatusTest.php @@ -185,6 +185,7 @@ public function testExecuteWithInconsistency() $migrations = $this->getMigrations(); $migrations->migrate(); + $migrations = $this->getMigrations(); $migrationPaths = $migrations->getConfig()->getMigrationPaths(); $migrationPath = array_pop($migrationPaths); $origin = $migrationPath . DS . '20150724233100_update_numbers_table.php'; @@ -248,7 +249,14 @@ protected function getMigrations() 'connection' => 'test', 'source' => 'TestsMigrations', ]; + $args = [ + '--connection' => $params['connection'], + '--source' => $params['source'], + ]; + $input = new ArrayInput($args, $this->command->getDefinition()); $migrations = new Migrations($params); + $migrations->setInput($input); + $this->command->setInput($input); $adapter = $migrations ->getManager($this->command->getConfig())