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

Consider migrating from phpspec/prophecy to PHPUnit mocks for test doubles #1569

Closed
acelaya opened this issue Oct 12, 2022 · 0 comments · Fixed by #1586
Closed

Consider migrating from phpspec/prophecy to PHPUnit mocks for test doubles #1569

acelaya opened this issue Oct 12, 2022 · 0 comments · Fixed by #1586

Comments

@acelaya
Copy link
Member

acelaya commented Oct 12, 2022

Pros:

  • One less dependency.
  • Get rid of workarounds, as PHPUnit no longer depends on prophecy.
  • Get rid of the use of traits.
  • PHPUnit is better maintained (more frequent updates and earlier support for new PHP versions).
  • Be able to use phpstan on tests via plugin, to make sure mocks are properly used.

Cons:

  • Syntax is slightly less nice.
  • Requires a bit more boilerplate to build mocks.
  • It's not possible to move expectations to after subject under test is invoked. You need to to predictions instead.

Docs: https://phpunit.readthedocs.io/en/9.5/test-doubles.html

@acelaya acelaya added this to Shlink Oct 12, 2022
@acelaya acelaya added this to the 3.4.0 milestone Oct 21, 2022
@acelaya acelaya moved this to In review 👀 in Shlink Oct 23, 2022
Repository owner moved this from In review 👀 to Done ✅ in Shlink Oct 23, 2022
@acelaya acelaya moved this from Done ✅ to In review 👀 in Shlink Dec 3, 2022
@acelaya acelaya moved this from In review 👀 to Done ✅ in Shlink Dec 3, 2022
@acelaya acelaya moved this from Done ✅ to In review 👀 in Shlink Dec 3, 2022
@acelaya acelaya moved this from In review 👀 to Done ✅ in Shlink Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant