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


PHP CommandTester::getStatusCode方法代碼示例

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


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

示例1: shouldExecuteConsumeCommand

 /**
  * @test
  */
 public function shouldExecuteConsumeCommand()
 {
     $application = new Application('prod');
     // Add command
     $command = new TestableConsumerCommand('fake:consumer', $this->getMockForAbstractClass('Boot\\RabbitMQ\\Consumer\\AbstractConsumer', [$this->queueTemplate], 'MockConsumer'), $this->createLogger());
     $application->add($command);
     // Create command tester
     $commandTester = new CommandTester($command);
     // Execute consumer
     $commandTester->execute(['command' => $command->getName()]);
     // Should have declared the queue once
     $this->assertEquals(1, $this->basicQueueDeclareInvocations->getInvocationCount());
     $args = $this->basicQueueDeclareInvocations->getInvocations()[0]->parameters;
     // Make sure that the queue name is correct
     $this->assertEquals('some_test_queue', $args[0]);
     // Make sure that the queue is durable
     $this->assertTrue($args[2], 'The queue is not durable!');
     // Make sure that the queue is not automatically deleted
     $this->assertFalse($args[4], 'The queue is automatically deleted!');
     // Should have declared the quality of service once
     $this->assertEquals(1, $this->basicQosInvocations->getInvocationCount());
     // Should have declared the quality of service once
     $this->assertEquals(1, $this->basicConsumeInvocations->getInvocationCount());
     // The wait method should have been invoked once
     $this->assertEquals(1, $this->waitInvocations->getInvocationCount());
     // Should have status code 0
     $this->assertEquals(0, $commandTester->getStatusCode());
 }
開發者ID:leadtech,項目名稱:boot-rabbit-mq,代碼行數:31,代碼來源:FaultTolerantBehaviourConsumerTest.php

示例2: it_displays_an_error_for_unresolved_characters

 /**
  * @test
  */
 public function it_displays_an_error_for_unresolved_characters()
 {
     $this->container['repository.test'] = new InMemoryRepository();
     $this->commandTester->execute(['command' => SearchCommand::COMMAND_NAME, '--from' => 'test', 'codepoint' => '1']);
     $output = $this->commandTester->getDisplay();
     $statusCode = $this->commandTester->getStatusCode();
     ha::assertThat('output', $output, hm::containsString('Character Not Found'));
     ha::assertThat('status code', $statusCode, hm::is(hm::identicalTo(1)));
 }
開發者ID:nick-jones,項目名稱:php-ucd,代碼行數:12,代碼來源:SearchCommandTest.php

示例3: it_displays_characters_residing_in_a_supplied_script

 /**
  * @test
  */
 public function it_displays_characters_residing_in_a_supplied_script()
 {
     $repository = new InMemoryRepository();
     $codepoint = Codepoint::fromInt(97);
     $script = Script::fromValue(Script::LATIN);
     $character = $this->buildCharacterWithCodepoint($codepoint, null, null, $script);
     $characters = Collection::fromArray([$character]);
     $repository->addMany($characters);
     $this->container['repository.test'] = $repository;
     $this->commandTester->execute(['command' => PropertiesCommand::COMMAND_NAME, '--from' => 'test', 'property-type' => PropertiesCommand::PROPERTY_SCRIPT, 'value' => $script->getValue()]);
     $output = $this->commandTester->getDisplay();
     $statusCode = $this->commandTester->getStatusCode();
     ha::assertThat('output', $output, hm::containsString('U+61:'));
     ha::assertThat('status code', $statusCode, hm::is(hm::identicalTo(0)));
 }
開發者ID:nick-jones,項目名稱:php-ucd,代碼行數:18,代碼來源:PropertiesCommandTest.php

示例4: testExecute

 public function testExecute()
 {
     $application = new Application($this->httpClient->getKernel());
     $application->add(new InitKillQueueCommand());
     /** @var InitKillQueueCommand $command */
     $command = $application->find('syrup:queue:kill-init');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName()]);
     $this->assertEquals(0, $commandTester->getStatusCode());
     /** @var QueueFactory $queueFactory */
     $queueFactory = $this->httpClient->getContainer()->get('syrup.queue_factory');
     $queueId = 'syrup_kill_' . str_replace('.keboola.com', '', gethostname());
     $queueService = $queueFactory->get($queueId);
     $this->assertInstanceOf('Keboola\\Syrup\\Service\\Queue\\QueueService', $queueService);
     $snsConfig = $this->httpClient->getContainer()->getParameter('sns');
     $snsClient = new SnsClient(['credentials' => ['key' => $snsConfig['key'], 'secret' => $snsConfig['secret']], 'region' => isset($snsConfig['region']) ? $snsConfig['region'] : 'us-east-1', 'version' => '2010-03-31']);
     $subscriptions = $snsClient->listSubscriptionsByTopic(['TopicArn' => $snsConfig['topic_arn']]);
     $ssArr = $subscriptions->get('Subscriptions');
     $ourSS = null;
     foreach ($ssArr as $ss) {
         if (false !== strstr($ss['Endpoint'], $queueId)) {
             $ourSS = $ss;
             break;
         }
     }
     $this->assertNotNull($ourSS);
     $this->assertEquals('sqs', $ourSS['Protocol']);
     $this->assertEquals($snsConfig['topic_arn'], $ourSS['TopicArn']);
 }
開發者ID:keboola,項目名稱:syrup-queue,代碼行數:29,代碼來源:InitKillQueueCommandTest.php

示例5: test01

    /**
     * Test audit table is created correctly.
     */
    public function test01()
    {
        $application = new Application();
        $application->add(new AuditCommand());
        /** @var AuditCommand $command */
        $command = $application->find('audit');
        $command->setRewriteConfigFile(false);
        $commandTester = new CommandTester($command);
        $commandTester->execute(['command' => $command->getName(), 'config file' => __DIR__ . '/config/audit.json']);
        $this->assertSame(0, $commandTester->getStatusCode());
        // Reconnect to DB.
        StaticDataLayer::connect('localhost', 'test', 'test', self::$dataSchema);
        $sql = sprintf('
select COLUMN_NAME        as column_name
,      COLUMN_TYPE        as column_type
,      IS_NULLABLE        as is_nullable
,      CHARACTER_SET_NAME as character_set_name
,      COLLATION_NAME     as collation_name
from   information_schema.COLUMNS
where  TABLE_SCHEMA = %s
and    TABLE_NAME   = %s
order by ORDINAL_POSITION', StaticDataLayer::quoteString(self::$auditSchema), StaticDataLayer::quoteString('AUT_COMPANY'));
        $rows = StaticDataLayer::executeRows($sql);
        $expected = [['column_name' => 'audit_timestamp', 'column_type' => 'timestamp', 'is_nullable' => 'NO', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'audit_statement', 'column_type' => "enum('INSERT','DELETE','UPDATE')", 'is_nullable' => 'NO', 'character_set_name' => 'ascii', 'collation_name' => 'ascii_general_ci'], ['column_name' => 'audit_type', 'column_type' => "enum('OLD','NEW')", 'is_nullable' => 'NO', 'character_set_name' => 'ascii', 'collation_name' => 'ascii_general_ci'], ['column_name' => 'audit_uuid', 'column_type' => 'bigint(20) unsigned', 'is_nullable' => 'NO', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'audit_rownum', 'column_type' => 'int(10) unsigned', 'is_nullable' => 'NO', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'audit_ses_id', 'column_type' => 'int(10) unsigned', 'is_nullable' => 'YES', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'audit_usr_id', 'column_type' => 'int(10) unsigned', 'is_nullable' => 'YES', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'cmp_id', 'column_type' => 'smallint(5) unsigned', 'is_nullable' => 'YES', 'character_set_name' => null, 'collation_name' => null], ['column_name' => 'cmp_abbr', 'column_type' => 'varchar(15)', 'is_nullable' => 'YES', 'character_set_name' => 'utf8', 'collation_name' => 'utf8_general_ci'], ['column_name' => 'cmp_label', 'column_type' => 'varchar(20)', 'is_nullable' => 'YES', 'character_set_name' => 'ascii', 'collation_name' => 'ascii_general_ci']];
        $this->assertEquals($expected, $rows);
    }
開發者ID:setbased,項目名稱:php-audit,代碼行數:29,代碼來源:AbcFrameworkTest.php

示例6: testCreateIndex

 public function testCreateIndex()
 {
     $command = $this->application->find('syrup:create-index');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['-d' => null]);
     $this->assertEquals(0, $commandTester->getStatusCode());
 }
開發者ID:ErikZigo,項目名稱:syrup,代碼行數:7,代碼來源:IndexCreateCommandTest.php

示例7: testRunJobWithMaintenance

 public function testRunJobWithMaintenance()
 {
     self::$kernel->getContainer()->set('syrup.job_executor', new MaintenanceExecutor());
     $jobId = $this->jobMapper->create($this->createJob());
     $this->commandTester->execute(['jobId' => $jobId]);
     $this->assertEquals(JobCommand::STATUS_LOCK, $this->commandTester->getStatusCode());
 }
開發者ID:ErikZigo,項目名稱:syrup,代碼行數:7,代碼來源:JobCommandTest.php

示例8: testSeedCommand

 /**
  * @expectedException        InvalidArgumentException
  * @expectedExceptionMessage Method should be one of: load, unload
  */
 public function testSeedCommand()
 {
     $command = $this->application->find('testseeds:country');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName(), 'method' => 'nonexistant']);
     $this->assertEquals($commandTester->getStatusCode(), 1);
 }
開發者ID:soyuka,項目名稱:SeedBundle,代碼行數:11,代碼來源:SeedCommandTest.php

示例9: test01

 public function test01()
 {
     $application = new AuditApplication();
     $command = $application->find('about');
     $commandTester = new CommandTester($command);
     $commandTester->execute(['command' => $command->getName()]);
     $this->assertSame(0, $commandTester->getStatusCode());
 }
開發者ID:setbased,項目名稱:php-audit,代碼行數:8,代碼來源:AboutTest.php

示例10: testBasic

 public function testBasic()
 {
     $this->client->expects($this->once())->method('query')->with('PUT', '/api/vhosts/%2F', []);
     $tester = new CommandTester($this->command);
     $tester->execute(['configFile' => 'Parser/fixture/config.yml']);
     $this->assertEquals("<>[info] Create vhost: /\n", $tester->getDisplay(true));
     $this->assertEquals(0, $tester->getStatusCode());
 }
開發者ID:metfan,項目名稱:rabbit-setup,代碼行數:8,代碼來源:ConfigExpertCommandTest.php

示例11: testShouldNotDownloadTheFileAgainIfAlreadyExistsOutputOnlyFilePathInNonInteractiveMode

 public function testShouldNotDownloadTheFileAgainIfAlreadyExistsOutputOnlyFilePathInNonInteractiveMode()
 {
     $this->command->setDownloader(new Downloader(__DIR__ . '/Fixtures/vendor/bin'));
     $this->mockUserInput("\n");
     $this->tester->execute(['command' => $this->command->getName(), 'version' => '5.67.8'], ['interactive' => false]);
     $this->assertEquals(realpath(__DIR__ . '/Fixtures/vendor/bin/selenium-server-standalone-5.67.8.jar') . "\n", $this->tester->getDisplay());
     $this->assertSame(0, $this->tester->getStatusCode());
 }
開發者ID:mhujer,項目名稱:steward,代碼行數:8,代碼來源:InstallCommandTest.php

示例12: testExecute

 /**
  * @dataProvider dataForTestExecute
  */
 public function testExecute($name, $yell, $expected)
 {
     $command = new GreetCommand();
     $tester = new CommandTester($command);
     $tester->execute(['name' => $name, '--yell' => $yell]);
     $this->assertSame(0, $tester->getStatusCode());
     $this->assertSame($expected, $tester->getDisplay());
 }
開發者ID:lemonphp,項目名稱:cli,代碼行數:11,代碼來源:GreetCommandTest.php

示例13: execute_creates_a_server_with_project_and_scripts

 /**
  * @test
  */
 public function execute_creates_a_server_with_project_and_scripts()
 {
     $mersey = $this->getLocalMerseyMock([['name' => 'testing', 'displayName' => 'Test Display', 'username' => 'testuser', 'hostname' => 'example.com', 'sshKey' => 'special_key', 'port' => 3000, 'projects' => [['name' => 'testproject', 'root' => '/project/root', 'scripts' => [['name' => 'testscript', 'description' => 'A Script', 'command' => 'my script']]]]]]);
     $command = $this->getApplication($mersey)->find('add');
     $this->mockAnswersUsingArray($command, [['server name/alias', 'testing'], ['server display name', 'Test Display'], ['SSH username', 'testuser'], ['hostname', 'example.com'], ['optional settings', 'y'], ['ssh key', 'special_key'], ['port', 3000], ['define a project', 'y'], ['project name', 'testproject'], ['project root', '/project/root'], ['scripts to the project', 'y'], ['script name', 'testscript'], ['script description', 'A Script'], ['script command', 'my script'], ['another script', 'n'], ['another project', 'n']]);
     $tester = new CommandTester($command);
     $tester->execute(['command' => $command->getName()]);
     $this->assertSame(0, $tester->getStatusCode(), 'Exit code is showing an error');
 }
開發者ID:dannyweeks,項目名稱:mersey,代碼行數:12,代碼來源:AddServerCommandTest.php

示例14: consume

 /**
  * Consume a queue for a specific amount of messages.
  *
  * @param string $vhost
  * @param string[] $queues
  * @param int $amount
  */
 public function consume($vhost, array $queues, $amount = 1)
 {
     $command = $this->getApplication()->find('amqp:consume');
     $tester = new CommandTester($command);
     $tester->execute(['--amount' => $amount, 'vhost' => $vhost, 'queues' => $queues]);
     if ($tester->getStatusCode() !== 0) {
         throw new \RuntimeException('amqp:consume failed to execute correctly');
     }
 }
開發者ID:boekkooi,項目名稱:tactician-amqp-extension,代碼行數:16,代碼來源:AmqpContext.php

示例15: execute_opens_server_config

 /**
  * @test
  */
 public function execute_opens_server_config()
 {
     $mersey = $this->getMerseyMock();
     $mersey->shouldReceive('getServersConfig')->andReturn('server-config.json');
     $command = $this->getApplication($mersey)->find('edit');
     $tester = new CommandTester($command);
     $tester->execute(['command' => $command->getName()], ['verbosity' => Output::VERBOSITY_DEBUG]);
     $this->assertContains('open server-config.json', $tester->getDisplay());
     $this->assertSame(0, $tester->getStatusCode(), 'Exit code is showing an error');
 }
開發者ID:dannyweeks,項目名稱:mersey,代碼行數:13,代碼來源:EditServersCommandTest.php


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