setName('tests/unit') ->setDescription('Unit tests') ->addOption('--extension', '-x', InputOption::VALUE_OPTIONAL, 'Extension name: "plugin/name", "theme/name"') ->addOption('--test', '-t', InputOption::VALUE_OPTIONAL, 'Tests filename'); } /** * @param InputInterface $input * @param OutputInterface $output * @return mixed */ protected function execute(InputInterface $input, OutputInterface $output) { $options = [ 'suite' => 'unit', ]; $testName = $input->getOption('test'); if (!empty($testName)) { $options['test'] = $testName; } try { if ($input->hasParameterOption(['--extension', '-x'])) { $extension = $this->getExtensionByOption('extension', $input, $output); if ($extension === false) { return 1; } return Dev::testsExtension($extension, 'run', $options, true); } else { return Dev::testsCore('run', $options, true); } } catch (Exception $e) { $output->writeln('' . $e->getMessage() . ''); return 1; } } }