Skip to content

PHPUnit broken in new setup project #2437

@RobQuistNL

Description

@RobQuistNL

API Platform version(s) affected: core 3.1.10

Description
Creating a project from the Github template (https://github.com/api-platform/api-platform/generate), then running docker compose exec php php ./vendor/bin/simple-phpunit throws an exception;

$ docker compose exec php php ./vendor/bin/simple-phpunit
PHPUnit 9.5.28 by Sebastian Bergmann and contributors.

Testing 
PHP Fatal error:  Declaration of SebastianBergmann\Comparator\ArrayComparator::assertEquals(mixed $expected, mixed $actual, float $delta = 0, bool $canonicalize = false, bool $ignoreCase = false, array &$processed = []): void must be compatible with SebastianBergmann\Comparator\Comparator::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false) in /srv/app/vendor/sebastian/comparator/src/ArrayComparator.php on line 36

Fatal error: Declaration of SebastianBergmann\Comparator\ArrayComparator::assertEquals(mixed $expected, mixed $actual, float $delta = 0, bool $canonicalize = false, bool $ignoreCase = false, array &$processed = []): void must be compatible with SebastianBergmann\Comparator\Comparator::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false) in /srv/app/vendor/sebastian/comparator/src/ArrayComparator.php on line 36

Remaining indirect deprecation notices (1)

  1x: The "Monolog\Logger" class is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Bridge\Monolog\Logger".
    1x in AuthenticationTest::testLogin from App\Tests

Symfony\Component\ErrorHandler\Error\FatalError^ {#13
  #message: "Compile Error: Declaration of SebastianBergmann\Comparator\ArrayComparator::assertEquals(mixed $expected, mixed $actual, float $delta = 0, bool $canonicalize = false, bool $ignoreCase = false, array &$processed = []): void must be compatible with SebastianBergmann\Comparator\Comparator::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false)"
  #code: 0
  #file: "/srv/app/vendor/sebastian/comparator/src/ArrayComparator.php"
  #line: 36
  -error: array:4 [
    "type" => 64
    "message" => "Declaration of SebastianBergmann\Comparator\ArrayComparator::assertEquals(mixed $expected, mixed $actual, float $delta = 0, bool $canonicalize = false, bool $ignoreCase = false, array &$processed = []): void must be compatible with SebastianBergmann\Comparator\Comparator::assertEquals($expected, $actual, $delta = 0, $canonicalize = false, $ignoreCase = false)"
    "file" => "/srv/app/vendor/sebastian/comparator/src/ArrayComparator.php"
    "line" => 36
  ]
}

How to reproduce
Clone project
Add alice by running composer require alice as described in the docs
Run tests

Possible Solution
Change the versions of PHPUnit that are used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions