grumPHP = $config; $this->registeredFilesLocator = $registeredFilesLocator; } public static function getDefaultName(): string { return self::COMMAND_NAME; } /** * Configure command. */ protected function configure(): void { $this->addOption( 'testsuite', null, InputOption::VALUE_REQUIRED, 'Specify which testsuite you want to run.', null ); $this->addOption( 'tasks', null, InputOption::VALUE_REQUIRED, 'Specify which tasks you want to run (comma separated). Example --tasks=task1,task2', null ); } public function execute(InputInterface $input, OutputInterface $output): int { $files = $this->getRegisteredFiles(); $testSuites = $this->grumPHP->getTestSuites(); $tasks = Str::explodeWithCleanup(',', $input->getOption("tasks") ?? ''); $context = new TaskRunnerContext( new RunContext($files), (bool) $input->getOption('testsuite') ? $testSuites->getRequired($input->getOption('testsuite')) : null, $tasks ); return $this->taskRunner()->run($output, $context); } protected function getRegisteredFiles(): FilesCollection { return $this->registeredFilesLocator->locate(); } protected function taskRunner(): TaskRunnerHelper { return $this->getHelper(TaskRunnerHelper::HELPER_NAME); } }