/** * @param DataSift\Storyplayer\ConfigLib\TestEnvironmentsList $envList * @param string $defaultEnvName */ public function __construct($envList, $defaultEnvName) { // define our name, and our description $this->setName('target'); $this->setShortDescription('set the environment to test against'); $this->setLongDesc("If you have multiple test environments listed in your configuration files, " . "you can use this switch to choose which test environment to run the test(s) " . "against. If you omit this switch, Storyplayer will default to using your " . "computer's hostname as the value for <environment>." . PHP_EOL . PHP_EOL . "If you only have one test environment listed, then this switch has no " . "effect when used, and Storyplayer will always use the test environment " . "from your configuration file." . PHP_EOL . PHP_EOL . "See http://datasift.github.io/storyplayer/ " . "for how to configure and use multiple test environments."); // what are the short switches? $this->addShortSwitch('t'); // what are the long switches? $this->addLongSwitch('target'); $this->addLongSwitch('test-environment'); // what is the required argument? $requiredArgMsg = "the environment to test against; one of:" . PHP_EOL . PHP_EOL; foreach ($envList->getEntryNames() as $envName) { $requiredArgMsg .= "* {$envName}" . PHP_EOL; } $requiredArgMsg .= PHP_EOL . ' '; $this->setRequiredArg('<environment>', $requiredArgMsg); $this->setArgValidator(new Feature_TestEnvironmentConfigValidator($envList, $defaultEnvName)); $this->setArgHasDefaultValueOf($defaultEnvName); // all done }