當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。