Chris@5: appName = $appName; Chris@5: $this->appVersion = $appVersion; Chris@5: } Chris@5: Chris@5: /** Chris@5: * Prepare our $argv array; put the app name in $argv[0] followed by Chris@5: * the command name and all command arguments and options. Chris@5: * Chris@5: * @param array $functionParameters should usually be func_get_args() Chris@5: * @param int $leadingParameterCount the number of function parameters Chris@5: * that are NOT part of argv. Default is 2 (expected content and Chris@5: * expected status code). Chris@5: */ Chris@5: protected function argv($functionParameters, $leadingParameterCount = 2) Chris@5: { Chris@5: $argv = $functionParameters; Chris@5: $argv = array_slice($argv, $leadingParameterCount); Chris@5: array_unshift($argv, $this->appName); Chris@5: Chris@5: return $argv; Chris@5: } Chris@5: Chris@5: /** Chris@5: * Simulated front controller Chris@5: */ Chris@5: protected function execute($argv, $commandClasses, $configurationFile = false) Chris@5: { Chris@5: // Define a global output object to capture the test results Chris@5: $output = new BufferedOutput(); Chris@5: Chris@5: // We can only call `Runner::execute()` once; then we need to tear down. Chris@5: $runner = new \Robo\Runner($commandClasses); Chris@5: if ($configurationFile) { Chris@5: $runner->setConfigurationFilename($configurationFile); Chris@5: } Chris@5: $statusCode = $runner->execute($argv, $this->appName, $this->appVersion, $output); Chris@5: Chris@5: // Destroy our container so that we can call $runner->execute() again for the next test. Chris@5: \Robo\Robo::unsetContainer(); Chris@5: Chris@5: // Return the output and status code. Chris@5: return [trim($output->fetch()), $statusCode]; Chris@5: } Chris@5: }