当前位置: 首页>>代码示例>>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;未经允许,请勿转载。