get() public method

public get ( $name )
 /**
  * Executor which runs a command.
  *
  * @param string $name
  * @param array  $args
  *
  * @return CommandTester
  */
 protected function executeCommand(string $name, array $args = []) : CommandTester
 {
     $application = new Application($this->getKernel());
     $tester = new CommandTester($application->get($name));
     $tester->execute($args, ['interactive' => false]);
     return $tester;
 }
Ejemplo n.º 2
0
 public function testBundleSingleCommandIsRetrievable()
 {
     $command = new Command('example');
     $bundle = $this->createBundleMock(array($command));
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $this->assertSame($command, $application->get('example'));
 }
Ejemplo n.º 3
0
 public function testBundleSingleCommandIsRetrievable()
 {
     $bundle = $this->getMock('Symfony\\Component\\HttpKernel\\Bundle\\Bundle');
     $bundle->expects($this->once())->method('registerCommands');
     $kernel = $this->getKernel(array($bundle));
     $application = new Application($kernel);
     $command = new Command('example');
     $application->add($command);
     $this->assertSame($command, $application->get('example'));
 }