Skip to content

Commit

Permalink
Merge pull request #3970 from thangnnmd/unitTest_SetupInstallCommand_…
Browse files Browse the repository at this point in the history
…execute

SetupInstallCommand::execute
  • Loading branch information
HungDV2022 authored Nov 7, 2024
2 parents df79239 + 163d408 commit 6514d53
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/baser-core/src/Command/SetupInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class SetupInstallCommand extends Command
* @return int|void|null
* @checked
* @noTodo
* @unitTest
*/
public function execute(Arguments $args, ConsoleIo $io)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace BaserCore\Test\TestCase\Command;

use BaserCore\TestSuite\BcTestCase;
use Cake\Command\Command;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;

class SetupInstallCommandTest extends BcTestCase
{
/**
* Trait
*/
use ConsoleIntegrationTestTrait;

/**
* setUp
*
* @return void
*/
public function setUp(): void
{
parent::setUp();
}

/**
* tearDown
*
* @return void
*/
public function tearDown(): void
{
parent::tearDown();
}

/**
* test execute
*/
public function testExecute()
{
//backup file
copy(ROOT . DS . 'config' . DS . 'install.php', ROOT . DS . 'config' . DS . 'install.php.bak');
//test
$this->exec('setup install');
$this->assertExitCode(Command::CODE_SUCCESS);
$this->assertOutputContains('インストールの準備ができました。');

//backup
rename(ROOT . DS . 'config' . DS . 'install.php.bak', ROOT . DS . 'config' . DS . 'install.php');
}
}

0 comments on commit 6514d53

Please sign in to comment.