mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-04 08:28:57 +02:00
Add exit code assertions in ListCommandTest
This commit is contained in:
@@ -89,7 +89,8 @@ class ListCommandTest extends BaseTest
|
|||||||
. "\t\t* local\n"
|
. "\t\t* local\n"
|
||||||
. "\t\t* production\n"
|
. "\t\t* production\n"
|
||||||
. "\t\t* rc\n"
|
. "\t\t* rc\n"
|
||||||
. "\t\n"
|
. "\t\n",
|
||||||
|
'expectedExitCode' => 0
|
||||||
),
|
),
|
||||||
'with_missing_yml_files' => array(
|
'with_missing_yml_files' => array(
|
||||||
'environmentFiles' => array(
|
'environmentFiles' => array(
|
||||||
@@ -98,18 +99,21 @@ class ListCommandTest extends BaseTest
|
|||||||
),
|
),
|
||||||
'expectedOutput' => "\tThese are your configured environments:\n"
|
'expectedOutput' => "\tThese are your configured environments:\n"
|
||||||
. "\t\t* production\n"
|
. "\t\t* production\n"
|
||||||
. "\t\n"
|
. "\t\n",
|
||||||
|
'expectedExitCode' => 0
|
||||||
),
|
),
|
||||||
'with_no_yml_configs' => array(
|
'with_no_yml_configs' => array(
|
||||||
'environmentFiles' => array(
|
'environmentFiles' => array(
|
||||||
'rc.ini',
|
'rc.ini',
|
||||||
'production.txt'
|
'production.txt'
|
||||||
),
|
),
|
||||||
'expectedOutput' => "\tYou don't have any environment configured.\n\n"
|
'expectedOutput' => "\tYou don't have any environment configured.\n\n",
|
||||||
|
'expectedExitCode' => 220
|
||||||
),
|
),
|
||||||
'with_no_configs' => array(
|
'with_no_configs' => array(
|
||||||
'environmentFiles' => array(),
|
'environmentFiles' => array(),
|
||||||
'expectedOutput' => "\tYou don't have any environment configured.\n\n"
|
'expectedOutput' => "\tYou don't have any environment configured.\n\n",
|
||||||
|
'expectedExitCode' => 220
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -119,14 +123,15 @@ class ListCommandTest extends BaseTest
|
|||||||
* @covers ::listEnvironments
|
* @covers ::listEnvironments
|
||||||
* @dataProvider listEnvironmentsProvider
|
* @dataProvider listEnvironmentsProvider
|
||||||
*/
|
*/
|
||||||
public function testListEnvironment($environmentFiles, $expectedOutput)
|
public function testListEnvironment($environmentFiles, $expectedOutput, $expectedExitCode)
|
||||||
{
|
{
|
||||||
$this->expectOutputString($expectedOutput);
|
$this->expectOutputString($expectedOutput);
|
||||||
|
|
||||||
$this->scandirValueObj->setValue($environmentFiles);
|
$this->scandirValueObj->setValue($environmentFiles);
|
||||||
$this->mockInputArgument('environments');
|
$this->mockInputArgument('environments');
|
||||||
|
|
||||||
$this->listCommand->run();
|
$actualExitCode = $this->listCommand->run();
|
||||||
|
$this->assertEquals($expectedExitCode, $actualExitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,7 +144,9 @@ class ListCommandTest extends BaseTest
|
|||||||
|
|
||||||
$this->mockInputArgument('abc');
|
$this->mockInputArgument('abc');
|
||||||
|
|
||||||
$this->listCommand->run();
|
$expectedExitCode = 221;
|
||||||
|
$actualExitCode = $this->listCommand->run();
|
||||||
|
$this->assertEquals($expectedExitCode, $actualExitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mockInputArgument($argumentValue)
|
private function mockInputArgument($argumentValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user