public function testHelp()
 {
     $application = new Application();
     $this->assertEquals($application->getHelp(), file_get_contents(self::$fixturesPath . '/application_gethelp.txt'), '->setHelp() returns a help message');
 }
Beispiel #2
0
 public function testHelp()
 {
     $application = new Application();
     $this->assertStringEqualsFile(self::$fixturesPath . '/application_gethelp.txt', $application->getHelp(), '->setHelp() returns a help message');
 }
// ->getVersion() ->getVersion()
$t->diag('->getVersion() ->getVersion()');
$application = new Application();
$application->setVersion('bar');
$t->is($application->getVersion(), 'bar', '->setVersion() sets the version of the application');

// ->getLongVersion()
$t->diag('->getLongVersion()');
$application = new Application('foo', 'bar');
$t->is($application->getLongVersion(), '<info>foo</info> version <comment>bar</comment>', '->getLongVersion() returns the long version of the application');

// ->getHelp()
$t->diag('->getHelp()');
$application = new Application();
$t->is($application->getHelp(), file_get_contents($fixtures.'/application_gethelp.txt'), '->setHelp() returns a help message');

// ->getCommands()
$t->diag('->getCommands()');
$application = new Application();
$commands = $application->getCommands();
$t->is(get_class($commands['help']), 'Symfony\\Components\\Console\\Command\\HelpCommand', '->getCommands() returns the registered commands');

$application->addCommand(new FooCommand());
$commands = $application->getCommands('foo');
$t->is(count($commands), 1, '->getCommands() takes a namespace as its first argument');

// ->register()
$t->diag('->register()');
$application = new Application();
$command = $application->register('foo');