You are here

public function CommandTest::testSetCode 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::testSetCode()

File

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

Class

CommandTest

Namespace

Symfony\Component\Console\Tests\Command

Code

public function testSetCode() {
  $command = new \TestCommand();
  $ret = $command
    ->setCode(function (InputInterface $input, OutputInterface $output) {
    $output
      ->writeln('from the code...');
  });
  $this
    ->assertEquals($command, $ret, '->setCode() implements a fluent interface');
  $tester = new CommandTester($command);
  $tester
    ->execute(array());
  $this
    ->assertEquals('interact called' . PHP_EOL . 'from the code...' . PHP_EOL, $tester
    ->getDisplay());
}