Skip to content
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

Add the ability to customize the __toString representation of a CallbackToken #573

Merged
merged 1 commit into from Feb 1, 2023
Merged

Add the ability to customize the __toString representation of a CallbackToken #573

merged 1 commit into from Feb 1, 2023

Conversation

ian-zunderdorp
Copy link
Contributor

Whenever we run tests using CallbackToken's and the CallbackToken fails to match, we get unhelpful assertion failures. When the specific test case does not use a lot of CallbackToken's, it is pretty easy to track which assertion has failed. This is aimed at the scenario where there are multiple identical function signatures with different CallbackToken's, so the following example becomes more readable:

    [exec]  Test  tests/unit/Example/ExampleTest.php:testItDoesSomething
     [exec] Expected exactly 1 calls that match:
     [exec]   Double\ExampleInterface\P2->doSomething(callback())
     [exec] but none were made.
     [exec] Recorded `doSomething(...)` calls:

should become

    [exec]  Test  tests/unit/Example/ExampleTest.php:testItDoesSomething
     [exec] Expected exactly 1 calls that match:
     [exec]   Double\ExampleInterface\P2->doSomething(Clear description)
     [exec] but none were made.
     [exec] Recorded `doSomething(...)` calls:

If you would like a separate issue for discussion, please let me know so I can create one.

@stof stof merged commit 9773795 into phpspec:master Feb 1, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants