本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Console\Application::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::get方法的具体用法?PHP Application::get怎么用?PHP Application::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Console\Application
的用法示例。
在下文中一共展示了Application::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeCommand
/**
* 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;
}
示例2: testBundleSingleCommandIsRetrievable
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'));
}
示例3: testBundleSingleCommandIsRetrievable
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'));
}