예제 #1
0
 public function testAsText()
 {
     $application = new Application();
     $application->addCommand(new \FooCommand());
     $this->assertStringEqualsFile(self::$fixturesPath . '/application_astext1.txt', $application->asText(), '->asText() returns a text representation of the application');
     $this->assertStringEqualsFile(self::$fixturesPath . '/application_astext2.txt', $application->asText('foo'), '->asText() returns a text representation of the application');
 }
예제 #2
0
$application->setCatchExceptions(false);
try
{
  $tester->run(array('command' => 'foo'));
  $t->fail('->setCatchExceptions() sets the catch exception flag');
}
catch (\Exception $e)
{
  $t->pass('->setCatchExceptions() sets the catch exception flag');
}

// ->asText()
$t->diag('->asText()');
$application = new Application();
$application->addCommand(new FooCommand);
$t->is($application->asText(), file_get_contents($fixtures.'/application_astext1.txt'), '->asText() returns a text representation of the application');
$t->is($application->asText('foo'), file_get_contents($fixtures.'/application_astext2.txt'), '->asText() returns a text representation of the application');

// ->asXml()
$t->diag('->asXml()');
$application = new Application();
$application->addCommand(new FooCommand);
$t->is($application->asXml(), file_get_contents($fixtures.'/application_asxml1.txt'), '->asXml() returns an XML representation of the application');
$t->is($application->asXml('foo'), file_get_contents($fixtures.'/application_asxml2.txt'), '->asXml() returns an XML representation of the application');

// ->renderException()
$t->diag('->renderException()');
$application = new Application();
$application->setAutoExit(false);
$tester = new ApplicationTester($application);