protected function requireValidExpectedSwitchName(DefinedSwitches $expectedOptions, $switchName)
 {
     if (!$expectedOptions->testHasSwitchByName($switchName)) {
         throw new \Exception("Unknown switch name " . $switchName);
     }
 }
 public function testCanRetrieveBothShortAndLongSwitches()
 {
     $switchName = 'help';
     $switchDesc = 'Display this help message';
     $obj = new DefinedSwitches();
     $origSwitch = $obj->addSwitch($switchName, $switchDesc);
     $origSwitch->setWithShortSwitch('h')->setWithShortSwitch('?')->setWithLongSwitch('help')->setWithLongSwitch('?');
     // did it work?
     $this->assertTrue($obj->testHasSwitchByName($switchName));
     $retrievedSwitch1 = $obj->getShortSwitch('h');
     $this->assertSame($origSwitch, $retrievedSwitch1);
     $retrievedSwitch2 = $obj->getShortSwitch('?');
     $this->assertSame($origSwitch, $retrievedSwitch2);
     $this->assertSame($retrievedSwitch1, $retrievedSwitch2);
     $retrievedSwitch3 = $obj->getLongSwitch('help');
     $this->assertSame($origSwitch, $retrievedSwitch1);
     $retrievedSwitch4 = $obj->getLongSwitch('?');
     $this->assertSame($origSwitch, $retrievedSwitch2);
     $this->assertSame($retrievedSwitch1, $retrievedSwitch2);
     $this->assertSame($retrievedSwitch1, $retrievedSwitch3);
     $this->assertSame($retrievedSwitch1, $retrievedSwitch4);
 }