Skip to content

Commit

Permalink
Added phpspec/prophecy-phpunit to Drupal 9.1 and later fixtures. (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisCarden authored Nov 18, 2020
1 parent f02f8af commit a435506
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- { env: ORCA_JOB=LOOSE_DEPRECATED_CODE_SCAN, name: "Loose deprecated code scan" }
- { env: ORCA_JOB=STRICT_DEPRECATED_CODE_SCAN, name: "Strict deprecated code scan" }
- { env: ORCA_JOB=DEPRECATED_CODE_SCAN_W_CONTRIB, name: "Deprecated code scan w/ contrib" }
- { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR, name: "Isolated test on next minor Drupal core version" }
- { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR ORCA_ENABLE_NIGHTWATCH=TRUE, name: "Isolated test on next minor Drupal core version with Nightwatch.js" }
- { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR, name: "Integrated test on next minor Drupal core version" }
- { env: ORCA_JOB=ISOLATED_TEST_ON_NEXT_MINOR_DEV, name: "Isolated test on next minor dev Drupal core version" }
- { env: ORCA_JOB=INTEGRATED_TEST_ON_NEXT_MINOR_DEV, name: "Integrated test on next minor dev Drupal core version" }
Expand Down
17 changes: 17 additions & 0 deletions src/Domain/Fixture/FixtureCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ private function fixDefaultDependencies(): void {
$additions[] = "drupal/core-dev:{$this->options->getCore()}";
}

if ($this->shouldRequireProphecyPhpunit()) {
$additions[] = 'phpspec/prophecy-phpunit:^2';
}

// Install requirements for deprecation checking.
$additions[] = 'mglaman/phpstan-drupal-deprecations';
$additions[] = 'nette/di:^3.0';
Expand Down Expand Up @@ -297,6 +301,19 @@ private function shouldRequireDrupalCoreDev(): bool {
return Comparator::greaterThanOrEqualTo($version, '8.8');
}

/**
* Determines whether or not to require phpspec/prophecy-phpunit.
*
* @see https://www.drupal.org/node/3176567
*
* @return bool
* Returns TRUE if it should be required, or FALSE if not.
*/
private function shouldRequireProphecyPhpunit(): bool {
$version = $this->options->getCoreResolved();
return Comparator::greaterThanOrEqualTo($version, '9.1');
}

/**
* Gets the list of unwanted packages.
*
Expand Down

0 comments on commit a435506

Please sign in to comment.