mirror of
https://github.com/opdavies/versa.git
synced 2025-02-02 07:57:32 +00:00
Use PHPUnit or ParaTest
This commit is contained in:
parent
7ee4e308d5
commit
50b5e15021
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Automatically use PHPUnit or ParaTest based on `require-dev` dependencies.
|
||||||
* Automatically find the PHP project type (i.e. Drupal or Sculpin) based on its `composer.json` dependencies.
|
* Automatically find the PHP project type (i.e. Drupal or Sculpin) based on its `composer.json` dependencies.
|
||||||
* Add `versa build` to build a Sculpin project.
|
* Add `versa build` to build a Sculpin project.
|
||||||
* Add `--extra-args` to pass extra arguments to the underlying command.
|
* Add `--extra-args` to pass extra arguments to the underlying command.
|
||||||
|
|
13
versa
13
versa
|
@ -44,6 +44,8 @@ $application->addOption(
|
||||||
$application->setCode(function (InputInterface $input): int {
|
$application->setCode(function (InputInterface $input): int {
|
||||||
$projectType = null;
|
$projectType = null;
|
||||||
|
|
||||||
|
$devDependencies = [];
|
||||||
|
|
||||||
$extraArgs = $input->getOption('extra-args');
|
$extraArgs = $input->getOption('extra-args');
|
||||||
$workingDir = $input->getOption('working-dir');
|
$workingDir = $input->getOption('working-dir');
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ $application->setCode(function (InputInterface $input): int {
|
||||||
);
|
);
|
||||||
|
|
||||||
$dependencies = array_keys($json['require']);
|
$dependencies = array_keys($json['require']);
|
||||||
|
$devDependencies = array_keys($json['require-dev']);
|
||||||
|
|
||||||
if (in_array(needle: 'drupal/core', haystack: $dependencies, strict: true) || in_array(needle: 'drupal/core-recommended', haystack: $dependencies, strict: true)) {
|
if (in_array(needle: 'drupal/core', haystack: $dependencies, strict: true) || in_array(needle: 'drupal/core-recommended', haystack: $dependencies, strict: true)) {
|
||||||
$projectType = ProjectType::Drupal->value;
|
$projectType = ProjectType::Drupal->value;
|
||||||
|
@ -135,10 +138,16 @@ $application->setCode(function (InputInterface $input): int {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'test':
|
case 'test':
|
||||||
// TODO: PHPUnit, Pest or ParaTest.
|
// TODO: Pest and Behat.
|
||||||
|
if (in_array(needle: 'brianium/paratest', haystack: $devDependencies, strict: true)) {
|
||||||
|
$command = ['./vendor/bin/paratest'];
|
||||||
|
} else {
|
||||||
|
$command = ['./vendor/bin/phpunit'];
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: commands in Docker Compose?
|
// TODO: commands in Docker Compose?
|
||||||
$process = Process::create(
|
$process = Process::create(
|
||||||
command: ['./vendor/bin/phpunit'],
|
command: $command,
|
||||||
extraArgs: $extraArgs,
|
extraArgs: $extraArgs,
|
||||||
workingDir: $workingDir,
|
workingDir: $workingDir,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue