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