#!/usr/bin/env php register(); // Get $rootPath based on $autoloadPath $rootPath = dirname($autoloadPath, 2); $argv = new ArgvInput(); $testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests')); $isDecorated = $argv->getParameterOption('--colors', 'always') !== 'never'; $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated); $container = Container::getInstance(); $container->add(TestSuite::class, $testSuite); $container->add(OutputInterface::class, $output); ValidatesEnvironment::in($testSuite); $args = $_SERVER['argv']; // Let's remove any arguments that PHPUnit does not understand if ($argv->hasParameterOption('--test-directory')) { foreach ($args as $key => $value) { if (strpos($value, '--test-directory') !== false) { unset($args[$key]); } } } if (($runInParallel = $argv->hasParameterOption(['--parallel', '-p'])) && !class_exists(\Pest\Parallel\Command::class)) { $output->writeln("Parallel support requires the Pest Parallel plugin. Run `composer require --dev pestphp/pest-plugin-parallel` first."); exit(Command::FAILURE); } $command = $runInParallel ? \Pest\Parallel\Command::class : \Pest\Console\Command::class; exit($container->get($command)->run($args)); })();