當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::get方法代碼示例

本文整理匯總了PHP中Symfony\Component\Console\Application::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::get方法的具體用法?PHP Application::get怎麽用?PHP Application::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Console\Application的用法示例。


在下文中一共展示了Application::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 protected function setUp()
 {
     $application = new Application();
     $application->add(new RepositoryTransferCommand($this->container));
     $command = $application->get(RepositoryTransferCommand::COMMAND_NAME);
     $this->commandTester = new CommandTester($command);
 }
開發者ID:nick-jones,項目名稱:php-ucd,代碼行數:7,代碼來源:RepositoryTransferCommandTest.php

示例2: testValidCommands

 public function testValidCommands()
 {
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\GenerateDocumentsCommand', $this->cli->get('odm:generate:documents'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\GenerateHydratorsCommand', $this->cli->get('odm:generate:hydrators'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\GenerateProxiesCommand', $this->cli->get('odm:generate:proxies'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\GenerateRepositoriesCommand', $this->cli->get('odm:generate:repositories'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\QueryCommand', $this->cli->get('odm:query'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\Schema\\CreateCommand', $this->cli->get('odm:schema:create'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\Schema\\UpdateCommand', $this->cli->get('odm:schema:update'));
     $this->assertInstanceOf('Doctrine\\ODM\\MongoDB\\Tools\\Console\\Command\\Schema\\DropCommand', $this->cli->get('odm:schema:drop'));
 }
開發者ID:RageZBla,項目名稱:DoctrineMongoODMModule,代碼行數:11,代碼來源:CliTest.php

示例3: setUp

 public function setUp()
 {
     $application = new Application();
     $application->add(new CreateOrganizationCommand());
     $this->command = $application->get('swp:organization:create');
     $this->question = $this->command->getHelper('question');
 }
開發者ID:SuperdeskWebPublisher,項目名稱:SWPMultiTenancyBundle,代碼行數:7,代碼來源:CreateOrganizationCommandTest.php

示例4: setUp

 protected function setUp()
 {
     $application = new Application();
     $application->add(new SearchCommand($this->container));
     $command = $application->get(SearchCommand::COMMAND_NAME);
     $this->commandTester = new CommandTester($command);
 }
開發者ID:nick-jones,項目名稱:php-ucd,代碼行數:7,代碼來源:SearchCommandTest.php

示例5: testExecute

    /**
     * @covers ::execute
     */
    public function testExecute()
    {
        $client = new ClientMock();
        $client->queueResponse('packagist/list.json')->queueResponse('packagist/list.json')->queueResponse('packagist/list.empty.json');
        $command = new SearchCommand($client);
        $console = new Application();
        $console->add($command);
        $tester = new CommandTester($console->get('search'));
        $tester->execute([]);
        $expected = <<<RESPONSE
Available Init Templates:
  clippings/package-template
  harp-orm/harp-template
  openbuildings/jam-template

RESPONSE;
        $this->assertEquals($expected, $tester->getDisplay());
        $tester->execute(['filter' => 'clip']);
        $expected = <<<RESPONSE
Available Init Templates:
  clippings/package-template

RESPONSE;
        $this->assertEquals($expected, $tester->getDisplay());
        $expected = <<<RESPONSE
No templates found

RESPONSE;
        $tester->execute([]);
        $this->assertEquals($expected, $tester->getDisplay());
    }
開發者ID:clippings,項目名稱:composer-init,代碼行數:34,代碼來源:SearchCommandTest.php

示例6: setUp

 public function setUp()
 {
     $application = new Application();
     $application->add(new CreateTenantCommand());
     $this->command = $application->get('swp:tenant:create');
     $this->question = $this->command->getHelper('question');
 }
開發者ID:SuperdeskWebPublisher,項目名稱:SWPMultiTenancyBundle,代碼行數:7,代碼來源:CreateTenantCommandTest.php

示例7: getCommandTester

 protected function getCommandTester(Command $command, $name, $params = [])
 {
     $application = new Application();
     $application->add($command);
     $tester = new CommandTester($application->get($name));
     $tester->execute(array_merge(['command' => $command->getName()], $params));
     return $tester;
 }
開發者ID:NextGenIntelligence,項目名稱:snipper,代碼行數:8,代碼來源:TestCase.php

示例8: testExecuteForApplicationCommandWithXmlOption

 public function testExecuteForApplicationCommandWithXmlOption()
 {
     $application = new Application();
     $commandTester = new CommandTester($application->get('help'));
     $commandTester->execute(array('command_name' => 'list', '--format' => 'xml'));
     $this->assertContains('list [--xml] [--raw] [--format FORMAT] [--] [&lt;namespace&gt;]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
     $this->assertContains('<command', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
 }
開發者ID:manhvu1212,項目名稱:videoplatform,代碼行數:8,代碼來源:HelpCommandTest.php

示例9: testExecuteForApplicationCommandWithXmlOption

 public function testExecuteForApplicationCommandWithXmlOption()
 {
     $application = new Application();
     $commandTester = new CommandTester($application->get('help'));
     $commandTester->execute(array('command_name' => 'list', '--format' => 'xml'));
     $this->assertRegExp('/list \\[--xml\\] \\[--raw\\] \\[--format="\\.\\.\\."\\] \\[namespace\\]/', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
     $this->assertRegExp('/<command/', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
 }
開發者ID:bardascat,項目名稱:blogify,代碼行數:8,代碼來源:HelpCommandTest.php

示例10: get

 /**
  * @inheritdoc
  */
 public function get($name)
 {
     $command = parent::get($name);
     if ($command instanceof ContainerAwareInterface) {
         $command->setContainer($this->kernel->getContainer());
     }
     return $command;
 }
開發者ID:fieg,項目名稱:console,代碼行數:11,代碼來源:Application.php

示例11: testExecute

 public function testExecute()
 {
     $application = new Application();
     $commandTester = new CommandTester($command = $application->get('list'));
     $commandTester->execute(array('command' => $command->getFullName()));
     $this->assertRegExp('/help   Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands');
     $commandTester->execute(array('command' => $command->getFullName(), '--xml' => true));
     $this->assertRegExp('/<command id="list" namespace="_global" name="list">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed');
 }
開發者ID:notbrain,項目名稱:symfony,代碼行數:9,代碼來源:ListCommandTest.php

示例12: testExecuteListsCommandsWithRawOption

    public function testExecuteListsCommandsWithRawOption()
    {
        $application = new Application();
        $commandTester = new CommandTester($command = $application->get('list'));
        $commandTester->execute(array('command' => $command->getName(), '--raw' => true));
        $output = <<<EOF
help   Displays help for a command
list   Lists commands

EOF;
        $this->assertEquals($output, $commandTester->getDisplay(true));
    }
開發者ID:brucewu16899,項目名稱:laravel-admin-panel,代碼行數:12,代碼來源:ListCommandTest.php

示例13: testArrayCallbackSyntax

 public function testArrayCallbackSyntax()
 {
     $console = new Application();
     $console->add(new LlamaCommand('test:llama-command', null, array($this, 'simpleCallback')));
     $this->assertTrue($console->has('test:llama-command'));
     $command = $console->get('test:llama-command');
     $this->assertInstanceOf('Beryllium\\Llama\\LlamaCommand', $command);
     $input = new ArrayInput(array('test:llama-command'));
     $output = new BufferedOutput();
     $command->run($input, $output);
     $this->assertSame("simple callback works\n", $output->fetch());
 }
開發者ID:beryllium,項目名稱:llama,代碼行數:12,代碼來源:LlamaCommandTest.php

示例14: testExecuteListsCommandsWithNamespaceArgument

    public function testExecuteListsCommandsWithNamespaceArgument()
    {
        require_once realpath(__DIR__ . '/../Fixtures/FooCommand.php');
        $application = new Application();
        $application->add(new \FooCommand());
        $commandTester = new CommandTester($command = $application->get('list'));
        $commandTester->execute(array('command' => $command->getName(), 'namespace' => 'foo', '--raw' => true));
        $output = <<<EOF
foo:bar   The foo:bar command

EOF;
        $this->assertEquals($output, $commandTester->getDisplay(true));
    }
開發者ID:TheTypoMaster,項目名稱:SPHERE-Framework,代碼行數:13,代碼來源:ListCommandTest.php

示例15: testExecuteCurrent

 public function testExecuteCurrent()
 {
     $manifest = $this->createFile();
     file_put_contents($manifest, '[]');
     $command = new Command('upgrade', true);
     $command->setManifestUri($manifest);
     $app = new Application('Test', '1.0.0');
     $app->getHelperSet()->set(new Helper());
     $app->add($command);
     $tester = new CommandTester($app->get('upgrade'));
     $tester->execute(array('command' => 'upgrade'));
     $this->assertRegExp('/Already up-to-date\\./', $tester->getDisplay());
 }
開發者ID:xing393939,項目名稱:Laravel-5-Bootstrap-3-Starter-Site,代碼行數:13,代碼來源:CommandTest.php


注:本文中的Symfony\Component\Console\Application::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。