You are here

public function CommandTest::testRunReturnsIntegerExitCode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/Command/CommandTest.php \Symfony\Component\Console\Tests\Command\CommandTest::testRunReturnsIntegerExitCode()

File

vendor/symfony/console/Tests/Command/CommandTest.php, line 256

Class

CommandTest

Namespace

Symfony\Component\Console\Tests\Command

Code

public function testRunReturnsIntegerExitCode() {
  $command = new \TestCommand();
  $exitCode = $command
    ->run(new StringInput(''), new NullOutput());
  $this
    ->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
  $command = $this
    ->getMock('TestCommand', array(
    'execute',
  ));
  $command
    ->expects($this
    ->once())
    ->method('execute')
    ->will($this
    ->returnValue('2.3'));
  $exitCode = $command
    ->run(new StringInput(''), new NullOutput());
  $this
    ->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
}