示例#1
0
$t->is($command1->getNamespace(), "", '->getNamespace() returns an empty namespace');
$t->is($command2->getNamespace(), "ns", '->getNamespace() returns a namespace "ns"');
$t->comment('nbCommandTest - Test fullname');
$t->is($command1->getFullname(), "foo", '->getFullName() returns a name without ":"');
$t->is($command2->getFullname(), "ns:bar", '->__construct() returns "ns:bar"');
$t->comment('nbCommandTest - Test arguments');
$t->is($command1->getArguments()->count(), 0, '->getArguments() returns 0 arguments');
$t->is($command2->getArguments()->count(), 1, '->getArguments() returns 1 argument');
$t->is($command3->getArguments()->count(), 0, '->getArguments() returns 0 arguments');
$command = new DummyCommand();
$command->addArgument(new nbArgument('foo'));
$t->is($command->getArguments()->count(), 1, '->addArgument() added 1 argument');
$t->comment('nbCommandTest - Test options');
$t->is($command1->getOptions()->count(), 0, '->getOptions() returns 0 options');
$t->is($command2->getOptions()->count(), 0, '->getOptions() returns 0 options');
$t->is($command3->getOptions()->count(), 1, '->getOptions() returns 1 option');
$command = new DummyCommand();
$command->addOption(new nbOption('foo'));
$t->is($command->getOptions()->count(), 1, '->addOption() added 1 option');
//$t->comment('nbCommandTest - Test synopsys');
//$t->is($command1->getSynopsys(), 'bee foo', '->getSynopsys() is "bee foo"');
//$t->is($command2->getSynopsys(), 'bee ns:bar [foo]', '->getSynopsys() is "bee ns:bar [foo]"');
$t->comment('nbCommandTest - Test shortcut');
$t->is($command1->hasShortcut('f'), true, '->hasShortcut() is true with "f"');
$t->is($command1->hasShortcut(':f'), true, '->hasShortcut() is true with ":f"');
$t->is($command1->hasShortcut('b'), false, '->hasShortcut() is true with "b"');
$t->is($command1->hasShortcut(':b'), false, '->hasShortcut() is true with ":b"');
$t->is($command2->hasShortcut('n:b'), true, '->hasShortcut() is true with "n:b"');
$t->is($command2->hasShortcut('ns:b'), true, '->hasShortcut() is true with "ns:b"');
$t->is($command2->hasShortcut('b'), true, '->hasShortcut() is true with "b"');
$t->is($command2->hasShortcut(':b'), true, '->hasShortcut() is true with ":b"');