本文整理汇总了PHP中Symfony\Component\Console\Application::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::find方法的具体用法?PHP Application::find怎么用?PHP Application::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Console\Application
的用法示例。
在下文中一共展示了Application::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testShouldReturnErrorIfThereIsFilesWithWrongStyle
public function testShouldReturnErrorIfThereIsFilesWithWrongStyle()
{
$kernel = $this->getMock(\stdClass::class);
/* @var \Behat\Gherkin\Parser|\PHPUnit_Framework_MockObject_MockObject $parser */
$parser = $this->getMockBuilder(Parser::class)->disableOriginalConstructor()->getMock();
/* @var \Behat\Gherkin\Node\FeatureNode|\PHPUnit_Framework_MockObject_MockObject $feature */
$feature = $this->getMockBuilder(FeatureNode::class)->disableOriginalConstructor()->getMock();
$feature->expects(self::once())->method('hasTags')->willReturn(true);
$feature->expects(self::once())->method('getKeyword')->willReturn('Feature');
$feature->expects(self::once())->method('getTags')->willReturn(['users', 'another-feature', 'another-tag']);
$feature->expects(self::once())->method('getTitle')->willReturn('User registration');
$feature->expects(self::once())->method('hasDescription')->willReturn(true);
$feature->expects(self::once())->method('getDescription')->willReturn("In order to order products\n" . "As a visitor\n" . "I need to be able to create an account in the store");
$feature->expects(self::once())->method('hasBackground')->willReturn(true);
$feature->expects(self::once())->method('getBackground')->willReturn($this->getBackground());
$feature->expects(self::once())->method('hasScenarios')->willReturn(false);
$parser->expects(self::once())->method('parse')->willReturn($feature);
$application = new Application($kernel);
$application->add(new CheckGherkinCodeStyle(null, $parser));
$command = $application->find('gherkin:check');
$commandTester = new CommandTester($command);
$commandTester->execute(['directory' => __DIR__ . '/../assets/left-aligned.feature']);
self::assertRegExp('/Wrong style/', $commandTester->getDisplay());
self::assertNotRegExp('/I need to be able to create an account in the store/', $commandTester->getDisplay());
}
示例2: setUp
/**
* Setup tests
* @return void
*/
protected function setUp()
{
$application = new Application();
$application->add(new SearchCommand());
$this->command = $application->find('search');
$this->commandTester = new CommandTester($this->command);
}
示例3: setUp
public function setUp()
{
$application = new Application();
$application->add(new UserTokenGenerateCommand());
$this->command = $application->find('user:token:generate');
$this->commandTester = new CommandTester($this->command);
}
示例4: testCommandInsideWrongDirectory
public function testCommandInsideWrongDirectory()
{
$command = $this->application->find('run');
$commandTester = new CommandTester($command);
$commandTester->execute(array('command' => $command->getName(), 'route' => 'catalog/attribute'));
$this->assertRegExp("/^.*ERROR: No Opencart installation found!.*\$/", $commandTester->getDisplay());
}
示例5: testGenerateProxies
public function testGenerateProxies()
{
$this->setExpectedException('Exception');
$command = $this->app->find('generate-proxies');
$test = new CommandTester($command);
$test->execute(array('command' => $command->getName()));
}
示例6: setUp
protected function setUp()
{
$this->application = new Application();
$this->application->add(new CalculatePomodorosCommand());
$this->command = $this->application->find('pomodoro:calculate');
$this->commandTester = new CommandTester($this->command);
}
示例7: getCommandTester
protected function getCommandTester()
{
$this->application->add($this->command);
$command = $this->application->find('phpci:create-build');
$commandTester = new CommandTester($command);
return $commandTester;
}
示例8: testFlushRegionName
public function testFlushRegionName()
{
$command = $this->application->find('orm:clear-cache:region:entity');
$tester = new CommandTester($command);
$tester->execute(array('command' => $command->getName(), 'entity-class' => 'Doctrine\\Tests\\Models\\Cache\\Country', '--flush' => true), array('decorated' => false));
$this->assertEquals('Flushing cache provider configured for entity named "Doctrine\\Tests\\Models\\Cache\\Country"' . PHP_EOL, $tester->getDisplay());
}
示例9: createTester
protected function createTester(ContainerAwareInterface $obj, $shortcat)
{
$this->app->add($obj);
$command = $this->app->find($shortcat);
$obj->setContainer($this->container);
return new CommandTester($command);
}
示例10: runTheCommand
/**
* @param string $command
* @param array $args
*/
public function runTheCommand($command, array $args = [])
{
$command = $this->application->find($command);
$testArguments = array_merge($args, ['command' => $command->getName()]);
$this->commandTester = new CommandTester($command);
$this->commandTester->execute($testArguments);
}
示例11: testFlushRegionName
public function testFlushRegionName()
{
$command = $this->application->find('orm:clear-cache:region:collection');
$tester = new CommandTester($command);
$tester->execute(array('command' => $command->getName(), 'owner-class' => 'Doctrine\\Tests\\Models\\Cache\\State', 'association' => 'cities', '--flush' => true), array('decorated' => false));
$this->assertEquals('Flushing cache provider configured for "Doctrine\\Tests\\Models\\Cache\\State#cities"' . PHP_EOL, $tester->getDisplay());
}
示例12: setUp
public function setUp()
{
parent::setUp();
$this->application = new Application();
$this->application->add(new \BackgroundCommandStub($this->commandName));
$this->command = $this->application->find($this->commandName);
$this->tester = new CommandTester($this->command);
}
示例13: getCommandTesterFor
/**
* @param string $command_class
* @return CommandTester
*/
protected function getCommandTesterFor($command_class) : CommandTester
{
/** @var Command $command */
$command = new $command_class();
$command->setContainer($this->getContainer());
$this->application->add($command);
return new CommandTester($this->application->find($command->getName()));
}
示例14: executeCommand
/**
* Build and execute the command tester.
*
* @param string $name command name
* @param array $args command arguments
* @param int $status expected return status
*
* @return CommandTester
*/
protected function executeCommand($name, $args, $status = 0)
{
$command = $this->application->find($name);
$commandTester = new CommandTester($command);
$args = array_merge(array('command' => $command->getName()), $args);
$this->assertEquals($status, $commandTester->execute($args));
return $commandTester;
}
示例15: getCommandTester
/**
* @return CommandTester
*/
protected function getCommandTester()
{
$this->application->getHelperSet()->set($this->dialog, 'dialog');
$this->application->add($this->command);
$command = $this->application->find('phpci:create-admin');
$commandTester = new CommandTester($command);
return $commandTester;
}