Skip to content

Cannot run tests with phpunit 12 Cannot override final method PHPUnit\Framework\TestCase::__construct() #6319

Description

@tenzap

Command:

cd tests && phpunit

Output:

PHP Fatal error:  Cannot override final method PHPUnit\Framework\TestCase::__construct() in /src/tests/mocks/ci_testcase.php on line 29

Fatal error: Cannot override final method PHPUnit\Framework\TestCase::__construct() in /src/tests/mocks/ci_testcase.php on line 29

This is likely because of that change in phpunit.

TestCase::__construct() is now declared final (it was annotated with @Final before and the announced changed from @Final to final for PHPUnit 12 was forgotten)

See: https://github.com/sebastianbergmann/phpunit/blob/12.0.10/ChangeLog-12.0.md#1203---2025-02-18

Versions
PHPUnit 12.3.6 by Sebastian Bergmann and contributors.
PHP 8.4.11

How to fix this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions