本文整理汇总了PHP中Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerAwareCommand::getName方法的具体用法?PHP ContainerAwareCommand::getName怎么用?PHP ContainerAwareCommand::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
的用法示例。
在下文中一共展示了ContainerAwareCommand::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecute
/**
* Check command execute.
*/
public function testExecute()
{
// Parameter was not set, so it has no value.
$this->commandTester->execute(['command' => $this->command->getName(), 'parameter' => 'test1']);
$this->assertContains('Parameter `test1`: has no value.', $this->commandTester->getDisplay());
$this->assertContains('If you want to write new value, use --set="<new value>" option.', $this->commandTester->getDisplay());
// Set some value, and test if it was set and returned.
$value = '2014-01-01 01:01:01';
$this->commandTester->execute(['command' => $this->command->getName(), 'parameter' => 'test1', '--set' => $value]);
$this->assertContains('New value written:', $this->commandTester->getDisplay());
/** @var Repository $repo */
$repo = $this->manager->getRepository('ONGRConnectionsBundle:Pair');
$parameter = $repo->find('test1');
$this->assertEquals($value, $parameter->getValue());
}
示例2: __construct
/**
* @param ContainerAwareCommand $command A ContainerAwareCommand instance to test
* @param ContainerInterface $container The container to be injected in the command to test
*/
public function __construct(ContainerAwareCommand $command, ContainerInterface $container)
{
$application = new Application('Paraunit Command Test: ' . $command->getName());
$application->add($command);
$this->container = $container;
$command->setContainer($container);
parent::__construct($command);
}