protected function getDevelopmentCommands() { if (!class_exists('TaskFile')) { return []; } $commands = []; $tasks = new TaskFile(); $runner = new Runner(); Config::setOutput(new ConsoleOutput()); $commandNames = array_filter(get_class_methods($tasks), function ($m) { return strpos($m, '__') === false; }); foreach ($commandNames as $commandName) { $command = $runner->createCommand(new TaskInfo('TaskFile', $commandName)); $command->setCode(function (InputInterface $input) use($tasks, $commandName) { // get passthru args $args = $input->getArguments(); array_shift($args); $args[] = $input->getOptions(); $res = call_user_func_array([$tasks, $commandName], $args); if (is_int($res)) { exit($res); } if (is_bool($res)) { exit($res ? 0 : 1); } if ($res instanceof Result) { exit($res->getExitCode()); } }); $commands[] = $command; } return $commands; }
public function testHandleError() { $tmpLevel = error_reporting(); $this->assertFalse($this->runner->handleError()); error_reporting(0); $this->assertTrue($this->runner->handleError()); error_reporting($tmpLevel); }
public function testTasksStopOnFail() { $argv = ['placeholder', 'test:stop-on-fail']; $result = $this->runner->execute($argv, Robo::output()); $this->guy->seeInOutput('['); $this->assertTrue($result > 0); }
/** * Runs the instantiated Terminus application * * @param InputInterface $input An input object to run the application with * @param OutputInterface $output An output object to run the application with * @return integer $status_code The exiting status code of the application */ public function run(InputInterface $input, OutputInterface $output) { if (!empty($cassette = $this->config->get('vcr_cassette')) && !empty($mode = $this->config->get('vcr_mode'))) { $this->startVCR(array_merge(compact('cassette'), compact('mode'))); } $status_code = $this->runner->run($input, $output, null, $this->commands); if (!empty($cassette) && !empty($mode)) { $this->stopVCR(); } return $status_code; }
public function testRunnerDebugOutput() { $argv = ['placeholder', 'test:verbosity', '-vvv']; $result = $this->runner->execute($argv, null, null, $this->guy->capturedOutputStream()); $this->guy->seeInOutput('This command will print more information at higher verbosity levels'); $this->guy->seeInOutput('This is a verbose message (-v).'); $this->guy->seeInOutput('This is a very verbose message (-vv).'); $this->guy->seeInOutput('This is a debug message (-vvv).'); $this->guy->seeInOutput(' [warning] This is a warning log message.'); $this->guy->seeInOutput(' [notice] This is a notice log message.'); $this->guy->seeInOutput(' [debug] This is a debug log message.'); $this->assertEquals(0, $result); }
/** * @return ConsoleOutput */ private function getOutput() { return Runner::getPrinter(); }
protected function createCommand($name) { return $this->runner->createCommand(new \Robo\TaskInfo(self::ROBOFILE, $name)); }
public function _after(\Codeception\TestCase $test) { \AspectMock\Test::clean(); Runner::setPrinter(null); }
public function _after(\Codeception\TestCase $test) { $this->getModule('Filesystem')->deleteDir(codecept_data_dir() . 'sandbox'); \Robo\Runner::setPrinter(null); chdir(codecept_root_dir()); }