Skip to content

Declaration of Codeception\Test\Test::toString() must be compatible with PHPUnit\Framework\SelfDescribing::toString(): #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
charlesdeb opened this issue Apr 23, 2020 · 3 comments

Comments

@charlesdeb
Copy link

charlesdeb commented Apr 23, 2020

I have been using PHP-mock-phpunit to mock out some built in PHP functions, and compared to some other PHP mocking libraries I have tried, it seems to work pretty well. And it also seems to integrate OK with CodeCeption's take on PHPUnit tests so that was good.

However, now that my unit tests are running and I switch back to continue on my phpbrowser acceptance tests with CodeCeption, I get the following error:

Codeception PHP Testing Framework v3.1.2
Powered by PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
Running with seed: 

PHP Fatal error:  Declaration of Codeception\Test\Test::toString() must be compatible with PHPUnit\Framework\SelfDescribing::toString(): string in /project/vendor/codeception/codeception/src/Codeception/Test/Test.php on line 18

Fatal error: Declaration of Codeception\Test\Test::toString() must be compatible with PHPUnit\Framework\SelfDescribing::toString(): string in /projectvendor/codeception/codeception/src/Codeception/Test/Test.php on line 18

and that's where it stops. I can't get the acceptance test to run at all.

If I use composer to uninstall PHP-mock-phpunit, then the acceptance tests fire up fine.

Presumably PHPMock is tweaking some classes behind the scenes and that is breaking things...

Here is my composer.json:

{
    "name": "my project",
    "description": "stuff",
    "require-dev": {
        "phpunit/phpunit": "^8",
        "codeception/codeception": "^3",
        "guzzlehttp/guzzle": "^6.3",
        "captbaritone/mailcatcher-codeception-module": "1.*",
        "codeception/specify": "^1",
        "codeception/stub": "^3",
        "dms/phpunit-arraysubset-asserts": "^0.1.0",
        "php-mock/php-mock-phpunit": "^2.6"
    },
    "require": {
        "mailjet/mailjet-apiv3-php": "^1.4",
        "stripe/stripe-php": "^7.14"
    }
}

Any suggestions?

@michalbundyra
Copy link
Member

@charlesdeb

It looks like more an issue with Codeception, see:

these are from versions you are using.

I cannot see any usage of SelfDescribing in this library.

@charlesdeb
Copy link
Author

charlesdeb commented Apr 23, 2020

Indeed, that seems very likely - neither of these files are PHPMock files. However, when I add PHPMock to the mix, Codeception stops working... I will link this issue to CodeCeption and see if one of the devs there can shed some light on the matter. Thanks for your speedy response.

Codeception issue: Codeception/Codeception#4978

@michalbundyra
Copy link
Member

Seems to be solved in upstream dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants