コード例 #1
0
ファイル: ApplicationTest.php プロジェクト: robo47/symfony
 public function testSetGetVersion()
 {
     $application = new Application();
     $application->setVersion('bar');
     $this->assertEquals('bar', $application->getVersion(), '->setVersion() sets the version of the application');
 }
コード例 #2
0
$application = new Application('foo', 'bar');
$t->is($application->getName(), 'foo', '__construct() takes the application name as its first argument');
$t->is($application->getVersion(), 'bar', '__construct() takes the application version as its first argument');
$t->is(array_keys($application->getCommands()), array('help', 'list'), '__construct() registered the help and list commands by default');

// ->setName() ->getName()
$t->diag('->setName() ->getName()');
$application = new Application();
$application->setName('foo');
$t->is($application->getName(), 'foo', '->setName() sets the name of the application');

// ->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();