You are here

public function ApplicationTest::testAdd in Zircon Profile 8

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

File

vendor/symfony/console/Tests/ApplicationTest.php, line 121

Class

ApplicationTest

Namespace

Symfony\Component\Console\Tests

Code

public function testAdd() {
  $application = new Application();
  $application
    ->add($foo = new \FooCommand());
  $commands = $application
    ->all();
  $this
    ->assertEquals($foo, $commands['foo:bar'], '->add() registers a command');
  $application = new Application();
  $application
    ->addCommands(array(
    $foo = new \FooCommand(),
    $foo1 = new \Foo1Command(),
  ));
  $commands = $application
    ->all();
  $this
    ->assertEquals(array(
    $foo,
    $foo1,
  ), array(
    $commands['foo:bar'],
    $commands['foo:bar1'],
  ), '->addCommands() registers an array of commands');
}