public function testCanRetrieveArrayOfAllSwitches() { $switch1Name = 'help'; $switch1Desc = 'Display this help message'; $obj = new DefinedSwitches(); $switch1 = $obj->addSwitch($switch1Name, $switch1Desc); $switch1->setWithShortSwitch('h')->setWithShortSwitch('?')->setWithLongSwitch('help')->setWithLongSwitch('?'); $switch2Name = 'version'; $switch2Desc = 'Display the version number of this app'; $switch2 = $obj->addSwitch($switch2Name, $switch2Desc); $switch2->setWithShortSwitch('v')->setWithShortSwitch('?')->setWithLongSwitch('?')->setWithLongSwitch('version'); // did it work? $switches = $obj->getSwitches(); $this->assertTrue(is_array($switches)); $this->assertEquals(2, count($switches)); $this->assertTrue(isset($switches[$switch1Name])); $this->assertSame($switch1, $switches[$switch1Name]); $this->assertTrue(isset($switches[$switch2Name])); $this->assertSame($switch2, $switches[$switch2Name]); }