From e2d102007558adeb20d38d811b5efa5b9be82be0 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Sat, 11 May 2024 23:28:16 -0400 Subject: [PATCH 1/2] Include the current backend in the entry point output This could be helpful when following up on support questions in the future. --- src/Command/EntryCommand.php | 4 ++++ tests/TestCase/Command/EntryCommandTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Command/EntryCommand.php b/src/Command/EntryCommand.php index cc218d6f..21747849 100644 --- a/src/Command/EntryCommand.php +++ b/src/Command/EntryCommand.php @@ -23,6 +23,7 @@ use Cake\Console\CommandCollectionAwareInterface; use Cake\Console\ConsoleIo; use Cake\Console\Exception\ConsoleException; +use Cake\Core\Configure; /** * Command that provides help and an entry point to migrations tools. @@ -82,11 +83,14 @@ public function run(array $argv, ConsoleIo $io): ?int // This is the variance from Command::run() if (!$args->getArgumentAt(0) && $args->getOption('help')) { + $backend = (string)(Configure::read('Migrations.backend') ?? 'phinx'); $io->out([ 'Migrations', '', "Migrations provides commands for managing your application's database schema and initial data.", '', + "Using {$backend} backend.", + '', ]); $help = $this->getHelp(); $this->executeCommand($help, [], $io); diff --git a/tests/TestCase/Command/EntryCommandTest.php b/tests/TestCase/Command/EntryCommandTest.php index 5fe64b9e..539b014f 100644 --- a/tests/TestCase/Command/EntryCommandTest.php +++ b/tests/TestCase/Command/EntryCommandTest.php @@ -44,6 +44,7 @@ public function testExecuteHelp() $this->exec('migrations --help'); $this->assertExitSuccess(); + $this->assertOutputContains('Using builtin backend'); $this->assertOutputContains('Available Commands'); $this->assertOutputContains('migrations migrate'); $this->assertOutputContains('migrations status'); From 61859b9061dfae03576b6be85a76f96c73c3b18c Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 13 May 2024 09:51:10 -0400 Subject: [PATCH 2/2] Use default parameter --- src/Command/EntryCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Command/EntryCommand.php b/src/Command/EntryCommand.php index 21747849..5d4ca0b7 100644 --- a/src/Command/EntryCommand.php +++ b/src/Command/EntryCommand.php @@ -83,7 +83,7 @@ public function run(array $argv, ConsoleIo $io): ?int // This is the variance from Command::run() if (!$args->getArgumentAt(0) && $args->getOption('help')) { - $backend = (string)(Configure::read('Migrations.backend') ?? 'phinx'); + $backend = Configure::read('Migrations.backend', 'phinx'); $io->out([ 'Migrations', '',