12 namespace Symfony\Component\Console\Tests\Tester;
26 $this->command =
new Command(
'foo');
27 $this->command->addArgument(
'command');
28 $this->command->addArgument(
'foo');
29 $this->command->setCode(
function ($input, $output) { $output->writeln(
'foo'); });
32 $this->tester->execute(array(
'foo' =>
'bar'), array(
'interactive' =>
false,
'decorated' =>
false,
'verbosity' =>
Output::VERBOSITY_VERBOSE));
37 $this->command = null;
43 $this->assertFalse($this->tester->getInput()->isInteractive(),
'->execute() takes an interactive option');
44 $this->assertFalse($this->tester->getOutput()->isDecorated(),
'->execute() takes a decorated option');
45 $this->assertEquals(
Output::VERBOSITY_VERBOSE, $this->tester->getOutput()->getVerbosity(),
'->execute() takes a verbosity option');
50 $this->assertEquals(
'bar', $this->tester->getInput()->getArgument(
'foo'),
'->getInput() returns the current input instance');
55 rewind($this->tester->getOutput()->getStream());
56 $this->assertEquals(
'foo'.PHP_EOL, stream_get_contents($this->tester->getOutput()->getStream()),
'->getOutput() returns the current output instance');
61 $this->assertEquals(
'foo'.PHP_EOL, $this->tester->getDisplay(),
'->getDisplay() returns the display of the last execution');
66 $this->assertSame(0, $this->tester->getStatusCode(),
'->getStatusCode() returns the status code');
72 $application->setAutoExit(
false);
75 $command->setCode(
function ($input, $output) { $output->writeln(
'foo'); });
82 $this->assertEquals(0,
$tester->execute(array()));