Skip to content

Commit

Permalink
handle --pest option
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Sep 14, 2023
1 parent 506318c commit 67ddb58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Commands/LocalCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/Commands/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected function configure()
$this
->setName('test')
->addOption('php', null, InputOption::VALUE_OPTIONAL, 'The PHP version that should be used to execute the tests')
->addOption('pest', null, InputOption::VALUE_NONE, 'Run Pest tests')
->setDescription('Run PHPUnit or Pest inside a simulated Vapor environment');
}

Expand All @@ -42,7 +43,7 @@ protected function configure()
*/
public function handle()
{
array_splice($_SERVER['argv'], 2, 0, $this->getTestRunnerBinary());
array_splice($_SERVER['argv'], 2, count($_SERVER['argv']), $this->getTestRunnerBinary());

$this->getApplication()->find('local')->run(new ArrayInput([
'--php' => $this->option('php'),
Expand All @@ -56,6 +57,6 @@ public function handle()
*/
protected function getTestRunnerBinary()
{
return is_executable('vendor/bin/pest') ? 'vendor/bin/pest' : 'vendor/bin/phpunit';
return $this->option('pest') ? 'vendor/bin/pest' : 'vendor/bin/phpunit';
}
}

0 comments on commit 67ddb58

Please sign in to comment.