From c14b44739950fa2ae26430e41f078c7b81541ccb Mon Sep 17 00:00:00 2001 From: thangnn Date: Fri, 1 Nov 2024 15:25:21 +0700 Subject: [PATCH 1/2] Add unitTest_SetupInstallCommand_execute --- .../src/Command/SetupInstallCommand.php | 1 + .../Command/SetupInstallCommandTest.php | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php diff --git a/plugins/baser-core/src/Command/SetupInstallCommand.php b/plugins/baser-core/src/Command/SetupInstallCommand.php index 412a7fd266..7db47d451f 100644 --- a/plugins/baser-core/src/Command/SetupInstallCommand.php +++ b/plugins/baser-core/src/Command/SetupInstallCommand.php @@ -41,6 +41,7 @@ class SetupInstallCommand extends Command * @return int|void|null * @checked * @noTodo + * @unitTest */ public function execute(Arguments $args, ConsoleIo $io) { diff --git a/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php b/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php new file mode 100644 index 0000000000..160db8bcef --- /dev/null +++ b/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php @@ -0,0 +1,51 @@ +exec('setup install test'); + $this->assertExitCode(Command::CODE_SUCCESS); + $this->assertOutputContains('インストールの準備ができました。'); + + //backup + rename(ROOT . DS . 'config' . DS . 'install.php.bak', ROOT . DS . 'config' . DS . 'install.php'); + } +} From 1306f1deb20e39c4bda45312b881f4a6c79a6cd2 Mon Sep 17 00:00:00 2001 From: thangnn Date: Fri, 1 Nov 2024 15:34:21 +0700 Subject: [PATCH 2/2] modified --- .../tests/TestCase/Command/SetupInstallCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php b/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php index 160db8bcef..e63f04b1c3 100644 --- a/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php +++ b/plugins/baser-core/tests/TestCase/Command/SetupInstallCommandTest.php @@ -41,7 +41,7 @@ public function testExecute() //backup file copy(ROOT . DS . 'config' . DS . 'install.php', ROOT . DS . 'config' . DS . 'install.php.bak'); //test - $this->exec('setup install test'); + $this->exec('setup install'); $this->assertExitCode(Command::CODE_SUCCESS); $this->assertOutputContains('インストールの準備ができました。');