I am in the process of writing some PHPUnit tests in Prophecy with the following code:
public function testItBuildsAndPersistsEnclosure()
{
$em = $this->prophesize(EntityManagerInterface::class);
}
Which yields me the following output:
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.
Testing Project Test Suite E.
2 / 2 (100%)Time: 105 ms, Memory: 6.00MB
There was 1 error:
1) Tests\AppBundle\Service\EnclosureBuilderServiceProphecyTest::testItBuildsAndPersistsEnclosure Error: Class 'Prophecy\Prophet' not found
I'm a bit new to PHPUnit and testing in general but as I understand it, PHPUnit is supposed to have built-in support for using Prophecy which makes the error above really surprising.
I tried installing phpspec/prophecy but that process failed as shown below:
composer require phpspec/prophecy
Using version ^1.10 for phpspec/prophecy
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install phpunit/phpunit 9.0.1
- Conclusion: remove doctrine/instantiator 1.1.0
- Installation request for phpunit/phpunit ^9.0 -> satisfiable by phpunit/phpunit[9.0.0, 9.0.1].
- Conclusion: don't install doctrine/instantiator 1.1.0
- phpunit/phpunit 9.0.0 requires doctrine/instantiator ^1.2.0 -> satisfiable by doctrine/instantiator[1.2.0, 1.3.0].
- Can only install one of: doctrine/instantiator[1.2.0, 1.1.0].
- Can only install one of: doctrine/instantiator[1.3.0, 1.1.0].
- Installation request for doctrine/instantiator (locked at 1.1.0) -> satisfiable by doctrine/instantiator[1.1.0].
Installation failed, reverting ./composer.json to its original content.