slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.94k stars 1.95k forks source link

phpspec/prophecy is now explicitely needed for tests #3227

Closed DavidPrevot closed 1 year ago

DavidPrevot commented 2 years ago

Bug Report

Since PHPUnit dropped phpspec/prophecy from its dependencies (https://github.com/sebastianbergmann/phpunit/issues/5033), the following errors are triggered when running the testsuite with latest PHPUnit.

There were 2 errors:

1) Slim\Tests\Http\RequestTest::testGetRequestTargetWithSlimPsr7Uri
PHPUnit\Framework\Exception: This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".

/tmp/autopkgtest-lxc._6y23c80/downtmp/build.jLX/src/tests/Http/RequestTest.php:458
/usr/bin/phpunit:73

2) Slim\Tests\Http\RequestTest::testGetRequestTargetWithNonSlimPsr7Uri
PHPUnit\Framework\Exception: This test uses TestCase::prophesize(), but phpspec/prophecy is not installed. Please run "composer require --dev phpspec/prophecy".

/tmp/autopkgtest-lxc._6y23c80/downtmp/build.jLX/src/tests/Http/RequestTest.php:477
/usr/bin/phpunit:73

Regards

David

odan commented 2 years ago

Have you tried to install phpspec/prophecy?

composer require phpspec/prophecy --dev

I guess the problem could be solved by adding phpspec/prophecy as a dev dependency to the project.

TestCase::prophesize() is deprecated and will be removed in PHPUnit 10. Using the trait provided by phpspec/prophecy-phpunit may help here.

l0gicgate commented 1 year ago

The dependency is in our require-dev: https://github.com/slimphp/Slim/blob/4.x/composer.json#L65

The test suite runs fine.