当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::find方法代码示例

本文整理汇总了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());
 }
开发者ID:malukenho,项目名称:kawaii-gherkin,代码行数:25,代码来源:CheckGherkinCodeStyleTest.php

示例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);
 }
开发者ID:cedric59,项目名称:infogreffe-unofficial-api,代码行数:11,代码来源:SearchCommandTest.php

示例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);
 }
开发者ID:jlekowski,项目名称:battleships-api,代码行数:7,代码来源:UserTokenGenerateCommandTest.php

示例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());
 }
开发者ID:beyondit,项目名称:ocok,代码行数:7,代码来源:BasicInitializationTest.php

示例5: testGenerateProxies

 public function testGenerateProxies()
 {
     $this->setExpectedException('Exception');
     $command = $this->app->find('generate-proxies');
     $test = new CommandTester($command);
     $test->execute(array('command' => $command->getName()));
 }
开发者ID:delboy1978uk,项目名称:common,代码行数:7,代码来源:GenerateProxiesTest.php

示例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);
 }
开发者ID:caveja,项目名称:pomocalc,代码行数:7,代码来源:CalculatePomodorosCommandTest.php

示例7: getCommandTester

 protected function getCommandTester()
 {
     $this->application->add($this->command);
     $command = $this->application->find('phpci:create-build');
     $commandTester = new CommandTester($command);
     return $commandTester;
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:7,代码来源:CreateBuildCommandTest.php

示例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());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:7,代码来源:ClearCacheEntityRegionCommandTest.php

示例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);
 }
开发者ID:symfony-bundles,项目名称:event-queue-bundle,代码行数:7,代码来源:ConsoleTestCase.php

示例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);
 }
开发者ID:cubicmushroom,项目名称:project-toolbelt,代码行数:11,代码来源:ConsoleCommand.php

示例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());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:7,代码来源:ClearCacheCollectionRegionCommandTest.php

示例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);
 }
开发者ID:phlib,项目名称:console-process,代码行数:8,代码来源:BackgroundCommandTest.php

示例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()));
 }
开发者ID:activecollab,项目名称:bootstrap,代码行数:12,代码来源:ModelCommandTestCase.php

示例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;
 }
开发者ID:wachterjohannes,项目名称:jackalope-doctrine-dbal,代码行数:17,代码来源:InitDoctrineDbalCommandTest.php

示例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;
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:11,代码来源:CreateAdminCommandTest.php


注:本文中的Symfony\Component\Console\Application::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。