diff --git a/src/Commands/LocalCommand.php b/src/Commands/LocalCommand.php index 35c6287e..e9a57553 100644 --- a/src/Commands/LocalCommand.php +++ b/src/Commands/LocalCommand.php @@ -57,7 +57,7 @@ protected function configure() */ public function handle() { - $options = array_slice($_SERVER['argv'], $this->option('php') ? 3 : 2); + $options = array_slice($_SERVER['argv'], $this->option('php') && array_search('--php='.$this->option('php'), $_SERVER['argv']) !== false ? 3 : 2); $status = 0; @@ -79,6 +79,7 @@ public function handle() '-e DB_USERNAME=vapor', '-e DB_PASSWORD=secret', '-e REDIS_HOST=redis', + '-w /app', '-v', Path::current().':/app', 'app', diff --git a/src/Commands/TestCommand.php b/src/Commands/TestCommand.php index e47ec7de..77a77dcb 100644 --- a/src/Commands/TestCommand.php +++ b/src/Commands/TestCommand.php @@ -30,7 +30,8 @@ protected function configure() $this ->setName('test') ->addOption('php', null, InputOption::VALUE_OPTIONAL, 'The PHP version that should be used to execute the tests') - ->setDescription('Run PHPUnit inside a simulated Vapor environment'); + ->addOption('pest', null, InputOption::VALUE_NONE, 'Run Pest tests') + ->setDescription('Run PHPUnit or Pest inside a simulated Vapor environment'); } /** @@ -42,10 +43,20 @@ protected function configure() */ public function handle() { - array_splice($_SERVER['argv'], 2, 0, 'vendor/bin/phpunit'); + array_splice($_SERVER['argv'], 2, count($_SERVER['argv']), $this->getTestRunnerBinary()); $this->getApplication()->find('local')->run(new ArrayInput([ '--php' => $this->option('php'), ]), $this->output); } + + /** + * Determine the test runner binary. + * + * @return string + */ + protected function getTestRunnerBinary() + { + return $this->option('pest') ? 'vendor/bin/pest' : 'vendor/bin/phpunit'; + } }