Skip to content

Commit

Permalink
Extendable Environment Variables in Laravel Test Command
Browse files Browse the repository at this point in the history
  • Loading branch information
paupenin committed Nov 28, 2021
1 parent 3776524 commit dc43b3f
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/Adapters/Laravel/Commands/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ public function handle()
),
null,
// Envs ...
$parallel ? [
'LARAVEL_PARALLEL_TESTING' => 1,
'LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES' => $this->option('recreate-databases'),
] : [],
$parallel ? $this->paratestEnvironmentVariables() : $this->phpunitEnvironmentVariables(),
))->setTimeout(null);

try {
Expand Down Expand Up @@ -181,6 +178,29 @@ protected function paratestArguments($options)
], $options);
}

/**
* Get the array of environment variables for running PHPUnit.
*
* @return array
*/
protected function phpunitEnvironmentVariables()
{
return [];
}

/**
* Get the array of environment variables for running Paratest.
*
* @return array
*/
protected function paratestEnvironmentVariables()
{
return [
'LARAVEL_PARALLEL_TESTING' => 1,
'LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES' => $this->option('recreate-databases'),
];
}

/**
* Clears any set Environment variables set by Laravel if the --env option is empty.
*
Expand Down

0 comments on commit dc43b3f

Please sign in to comment.