vbulash
vbulash

Reputation: 171

Incompatibility between Hamcrest / Pest / Laravel

Unit-tests (written with Pest functions) works well by php artisan test.

But when I try to directly use Pest by ./vendor/bin/pest --configuration /var/www/html/phpunit.xml ., then got:

PHP Fatal error:  Declaration of Hamcrest\Core\CombinableMatcherTest::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void in /var/www/html/vendor/hamcrest/hamcrest-php/tests/Hamcrest/Core/CombinableMatcherTest.php on line 10

How to fix it?

P.S. PHPUnit.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" bootstrap="vendor/autoload.php"
         colors="true">
    <testsuites>
        <testsuite name="Unit">
            <directory>./tests/Unit</directory>
        </testsuite>
        <testsuite name="Feature">
            <directory>./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <coverage/>
    <php>
        some environment here...
    </php>
    <source>
        <include>
            <directory>./app</directory>
        </include>
    </source>
</phpunit>

P.P.S. Same for Laravel 11

Upvotes: 0

Views: 17

Answers (0)

Related Questions