#!/usr/bin/env php $value) { if (str_contains($value, '--compact')) { $_SERVER['COLLISION_PRINTER_COMPACT'] = 'true'; unset($args[$key]); } if (str_contains($value, '--profile')) { $_SERVER['COLLISION_PRINTER_PROFILE'] = 'true'; unset($args[$key]); } if (str_contains($value, '--test-directory')) { unset($args[$key]); } if (str_contains($value, '--dirty')) { $dirty = true; unset($args[$key]); } if (str_contains($value, '--todo')) { $todo = true; unset($args[$key]); } if (str_contains($value, '--teamcity')) { unset($args[$key]); $args[] = '--no-output'; unset($_SERVER['COLLISION_PRINTER']); } } // Used when Pest is required using composer. $vendorPath = dirname(__DIR__, 4).'/vendor/autoload.php'; // Used when Pest maintainers are running Pest tests. $localPath = dirname(__DIR__).'/vendor/autoload.php'; if (file_exists($vendorPath)) { include_once $vendorPath; $autoloadPath = $vendorPath; } else { include_once $localPath; $autoloadPath = $localPath; } // Get $rootPath based on $autoloadPath $rootPath = dirname($autoloadPath, 2); $argv = new ArgvInput(); $testSuite = TestSuite::getInstance( $rootPath, $argv->getParameterOption('--test-directory', (new ConfigLoader($rootPath))->getTestsDirectory()), ); if ($dirty) { $testSuite->tests->addTestCaseFilter(new GitDirtyTestCaseFilter($rootPath)); } if ($todo) { $testSuite->tests->addTestCaseMethodFilter(new TodoTestCaseFilter()); } $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); $container->add(InputInterface::class, $argv); $container->add(Container::class, $container); $kernel = Kernel::boot(); $result = $kernel->handle($output, $args); $kernel->shutdown(); exit($result); })();