$optionSet->addOption($foo2); $t->fail('->addOption() throws a sfCommandException if the another option is already registered with the same name'); } catch (sfCommandException $e) { $t->pass('->addOption() throws a sfCommandException if the another option is already registered with the same name'); } try { $optionSet->addOption($foo1); $t->fail('->addOption() throws a sfCommandException if the another option is already registered with the same shortcut'); } catch (sfCommandException $e) { $t->pass('->addOption() throws a sfCommandException if the another option is already registered with the same shortcut'); } // ->getOption() $t->diag('->getOption()'); $optionSet = new sfCommandOptionSet(); $optionSet->addOptions(array($foo)); $t->is($optionSet->getOption('foo'), $foo, '->getOption() returns a sfCommandOption by its name'); try { $optionSet->getOption('bar'); $t->fail('->getOption() throws an exception if the option name does not exist'); } catch (sfCommandException $e) { $t->pass('->getOption() throws an exception if the option name does not exist'); } // ->hasOption() $t->diag('->hasOption()'); $optionSet = new sfCommandOptionSet(); $optionSet->addOptions(array($foo)); $t->is($optionSet->hasOption('foo'), true, '->hasOption() returns true if a sfCommandOption exists for the given name'); $t->is($optionSet->hasOption('bar'), false, '->hasOption() returns false if a sfCommandOption exists for the given name'); // ->hasShortcut() $t->diag('->hasShortcut()'); $optionSet = new sfCommandOptionSet();