public function testCanCheckForSwitch() { // define the options we are expecting $expectedOptions = new DefinedSwitches(); // create the switch to add $switchName = 'fred'; $switchDesc = 'trout'; $expectedOptions->addSwitch($switchName, $switchDesc); // create the ParsedSwitches object $ParsedSwitches = new ParsedSwitches($expectedOptions); $ParsedSwitches->addSwitch($expectedOptions, $switchName); // did it work? $this->assertTrue($ParsedSwitches->testHasSwitch($switchName)); // if the switch is not there? $this->assertFalse($ParsedSwitches->testHasSwitch('harry')); }
protected function loadPhixCommands(Context $context, ParsedSwitches $ParsedSwitches) { // create something to find the commands $commandsFinder = new CommandsFinder(); // seed the commandsFinder with a list of where to look // if the user has given us any hints if ($ParsedSwitches->testHasSwitch("include")) { $switch = $ParsedSwitches->getSwitch("include"); $args = $ParsedSwitches->getArgsForSwitch("include"); foreach ($args as $path) { $commandsFinder->addFolderToSearch($path); } } // alright, let's thrash that hard disk // hope you have an SSD ;-) $commandsList = $commandsFinder->findCommands(); // all done return $commandsList; }