Skip to content

Commit

Permalink
Merge pull request #3969 from HungDV2022/unittest_CreateReleaseComman…
Browse files Browse the repository at this point in the history
…d_execute

CreateReleaseCommand::execute() ユニットテスト
  • Loading branch information
HungDV2022 authored Nov 7, 2024
2 parents 7367bd3 + 1b644dc commit df79239
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/baser-core/src/Command/CreateReleaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ protected function buildOptionParser(\Cake\Console\ConsoleOptionParser $parser):
* @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
Expand Up @@ -4,12 +4,19 @@

use BaserCore\Command\CreateReleaseCommand;
use BaserCore\TestSuite\BcTestCase;
use Cake\Command\Command;
use Cake\Console\ConsoleOptionParser;
use BaserCore\Utility\BcFolder;
use Cake\Core\Configure;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;

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

private $packagePath;
private $zipFile;
public function setUp(): void
Expand Down Expand Up @@ -68,6 +75,22 @@ public function testBuildOptionParser()
$this->assertEquals('master', $options['branch']->defaultValue());
}

/**
* test execute
*/
public function testExecute()
{
//異常テスト
$this->exec('create release');
$this->assertExitCode(Command::CODE_ERROR);

//正常テスト
$this->exec('create release 5.1.1');
$this->assertExitCode(Command::CODE_SUCCESS);
$this->assertOutputContains('リリースパッケージの作成が完了しました。/tmp/basercms.zip を確認してください。');
$this->assertTrue(file_exists(TMP . 'basercms-5.1.1.zip'));
unlink(TMP . 'basercms-5.1.1.zip');
}

/**
* Test deleteExcludeFiles
Expand Down

0 comments on commit df79239

Please sign in to comment.