public function testSetAliasesWithNamingConflict() { $opts = new Zend_Console_Getopt('abp:', array('--apple')); $opts->setAliases(array('a' => 'apple')); try { $opts->setAliases(array('b' => 'apple')); } catch (Zend_Console_Getopt_Exception $e) { $this->assertEquals($e->getMessage(), 'Option "--apple" is being defined more than once.'); } }
public function testGetoptSetAliasesInvalid() { $opts = new Zend_Console_Getopt('abp:', array('--apple')); $opts->setAliases(array('c' => 'cumquat')); $opts->setArguments(array('-c')); try { $opts->parse(); $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Zend_Exception $e) { $this->assertType('Zend_Console_Getopt_Exception', $e, 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); $this->assertEquals('Option "c" is not recognized.', $e->getMessage()); } }
public function testGetoptSetAliasesWithNamingConflict() { $opts = new Zend_Console_Getopt('abp:', array('--apple')); $opts->setAliases(array('a' => 'apple')); try { $opts->setAliases(array('b' => 'apple')); $this->fail('Expected to catch Zend_Console_Getopt_Exception'); } catch (Exception $e) { $this->assertType('Zend_Console_Getopt_Exception', $e, 'Expected Zend_Console_Getopt_Exception, got ' . get_class($e)); $this->assertEquals($e->getMessage(), 'Option "--apple" is being defined more than once.'); } }