I'm discovering API Platform and i'm now at the "Testing the API" step.
I get two different errors I can't resolve, event avec a composer install / update :
1) App\Tests\BooksTest::testGetCollection
Error: Call to undefined method ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Constraint\ArraySubsetLegacy::exporter()
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetTrait.php:76
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetTrait.php:84
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetTrait.php:68
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Constraint/ArraySubsetLegacy.php:32
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/ApiTestAssertionsTrait.php:100
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/ApiTestAssertionsTrait.php:57
/srv/api/tests/BooksTest.php:26
and
4) App\Tests\BooksTest::testUpdateBook
TypeError: Argument 2 passed to ApiPlatform\Core\Bridge\Symfony\Bundle\Test\Client::request() must be of the type string, null given, called in /srv/api/tests/BooksTest.php on line 103
/srv/api/vendor/api-platform/core/src/Bridge/Symfony/Bundle/Test/Client.php:88
/srv/api/tests/BooksTest.php:103
Any idea ?
Thx :-)
according to this issue on API Platform the API Platform framework uses phpUnit 7.5 by default, but some of the test functions use phpUnit 8.
you can supposedly set SYMFONY_PHPUNIT_VERSION to 8.3 as an environment variable, but that didn't work in my case. I had to edit api/phpunit.xml.dist and change the value in there to look like this: