You are here

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

File

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

Class

CommandTest

Namespace

Symfony\Component\Console\Tests\Command

Code

public function testSetGetDefinition() {
  $command = new \TestCommand();
  $ret = $command
    ->setDefinition($definition = new InputDefinition());
  $this
    ->assertEquals($command, $ret, '->setDefinition() implements a fluent interface');
  $this
    ->assertEquals($definition, $command
    ->getDefinition(), '->setDefinition() sets the current InputDefinition instance');
  $command
    ->setDefinition(array(
    new InputArgument('foo'),
    new InputOption('bar'),
  ));
  $this
    ->assertTrue($command
    ->getDefinition()
    ->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument');
  $this
    ->assertTrue($command
    ->getDefinition()
    ->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument');
  $command
    ->setDefinition(new InputDefinition());
}