Esempio n. 1
0
 public function testAsXml()
 {
     $application = new Application();
     $application->addCommand(new \FooCommand());
     $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
     $this->assertXmlStringEqualsXmlFile(self::$fixturesPath . '/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
 }
Esempio n. 2
0
{
  $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);

$tester->run(array('command' => 'foo'));
$t->is($tester->getDisplay(), file_get_contents($fixtures.'/application_renderexception1.txt'), '->renderException() renders a pretty exception');

$tester->run(array('command' => 'foo'), array('verbosity' => Output::VERBOSITY_VERBOSE));
$t->like($tester->getDisplay(), '/Exception trace/', '->renderException() renders a pretty exception with a stack trace when verbosity is verbose');

$tester->run(array('command' => 'list', '--foo' => true));