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


PHP ApplicationTester::getStatusCode方法代码示例

本文整理汇总了PHP中Symfony\Component\Console\Tester\ApplicationTester::getStatusCode方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationTester::getStatusCode方法的具体用法?PHP ApplicationTester::getStatusCode怎么用?PHP ApplicationTester::getStatusCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Console\Tester\ApplicationTester的用法示例。


在下文中一共展示了ApplicationTester::getStatusCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testExecute

 public function testExecute()
 {
     $application = new Stratum();
     $application->setAutoExit(false);
     $tester = new ApplicationTester($application);
     $tester->run(['config file' => 'test/MySql/etc/stratum.cfg']);
     $this->assertSame(0, $tester->getStatusCode(), $tester->getDisplay());
 }
开发者ID:setbased,项目名称:php-stratum,代码行数:8,代码来源:StratumApplicationTest.php

示例2: testExistingHubApplication

 /**
  * Test Successful doRun.
  */
 function testExistingHubApplication()
 {
     // Create a Mock Process Object.
     $process = $this->getMockBuilder('Symfony\\Component\\Process\\Process')->disableOriginalConstructor()->getMock();
     // Make sure the isSuccessful method return FALSE so flo throws an exception.
     $process->method('isSuccessful')->willReturn(TRUE);
     $app = new Console\Application();
     // Set autoExit to false when testing & do not let it catch exceptions.
     $app->setAutoExit(FALSE);
     // Overwrite Symfony\Component\Process\Process with our mock Process.
     $app->setProcess($process);
     // Run a command and wait for the exception.
     $appTester = new ApplicationTester($app);
     $appTester->run(array('command' => 'help'));
     $this->assertEquals(0, $appTester->getStatusCode());
 }
开发者ID:rabellamy,项目名称:flo,代码行数:19,代码来源:ApplicationTest.php

示例3: testRunWithErrorFailingStatusCode

 public function testRunWithErrorFailingStatusCode()
 {
     $application = new Application();
     $application->setDispatcher($this->getDispatcher());
     $application->setAutoExit(false);
     $application->register('dus')->setCode(function (InputInterface $input, OutputInterface $output) {
         $output->write('dus.');
         throw new \Error('duserr');
     });
     $tester = new ApplicationTester($application);
     $tester->run(array('command' => 'dus'));
     $this->assertSame(1, $tester->getStatusCode(), 'Status code should be 1');
 }
开发者ID:heximcz,项目名称:bind-manager,代码行数:13,代码来源:ApplicationTest.php

示例4: testRunAsRoot

 public function testRunAsRoot()
 {
     $stub = $this->getMock('SugarCli\\Console\\Application', array('isRunByRoot'), array('test', 'test'));
     $stub->method('isRunByRoot')->willReturn(true);
     $stub->setAutoExit(false);
     $stub->add(new TestCommand());
     $selfupdate_cmd = new TestCommand();
     $selfupdate_cmd->setName('list');
     $stub->add($selfupdate_cmd);
     $tester = new ApplicationTester($stub);
     $tester->run(array('command' => 'test:command'));
     $this->assertEquals(6, $tester->getStatusCode());
     $this->assertEquals('You are not allowed to run this command as root.' . PHP_EOL, $tester->getDisplay());
     $tester = new ApplicationTester($stub);
     $tester->run(array('command' => 'list'));
     $this->assertEquals(0, $tester->getStatusCode());
     $this->assertEquals(PHP_EOL, $tester->getDisplay());
 }
开发者ID:inetprocess,项目名称:sugarcli,代码行数:18,代码来源:ApplicationTest.php

示例5: getExitCode

 /**
  * @return int 0 success otherwise fail
  */
 public function getExitCode()
 {
     return $this->tester->getStatusCode() !== null ? $this->tester->getStatusCode() : 1;
 }
开发者ID:rezzza,项目名称:tk1-contexts,代码行数:7,代码来源:CommandContext.php


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