Issue when running tests with php unit < 9 cannot find php prophecy

Created on 9 May 2023, over 1 year ago
Updated 8 December 2023, about 1 year ago

When checking out 3.x branch and using 9.x branch of lando/Drupal-Contriibutions it is possible to run the tests after clonimg module in web/modules folder

When running the tests like so:

`lando phpunit --group subrequests`

I appear to have a missing dependency, php phophecy

Fatal error: Trait "Prophecy\PhpUnit\ProphecyTrait" not found in /app/web/modules/subrequests/tests/src/Unit/Blueprint/BlueprintManagerTest.php on line 22

I have tried to install e.g.

composer require --dev phpspec/prophecy-phpunit:^2

However composer does not appear to want to install on php unit less than 9

e.g.

composer require phpspec/prophecy-phpunit
Using version ^2.0 for phpspec/prophecy-phpunit
./composer.json has been updated
Running composer update phpspec/prophecy-phpunit
> Drupal\Composer\Composer::ensureComposerVersion
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- phpspec/prophecy-phpunit dev-master requires phpspec/prophecy ^1.18 -> found phpspec/prophecy[dev-master, 1.x-dev (alias of dev-master)] but the package is fixed to v1.15.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- phpspec/prophecy-phpunit[v2.0.0, ..., v2.0.2] require phpunit/phpunit ^9.1 -> found phpunit/phpunit[9.1.0, ..., 9.6.x-dev] but the package is fixed to 8.5.26 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- phpspec/prophecy-phpunit 2.0.x-dev is an alias of phpspec/prophecy-phpunit dev-master and thus requires it to be installed too.
- Root composer.json requires phpspec/prophecy-phpunit ^2.0 -> satisfiable by phpspec/prophecy-phpunit[v2.0.0, v2.0.1, v2.0.2, 2.0.x-dev (alias of dev-master)].

will try running gain on 10.x branch but my guess is tests should also run when using older versions of php unit without support for php prophecy

πŸ’¬ Support request
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom 2dareis2do

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024