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

[Laravel100] Adds ReplaceExpectsMethodsInTests rule #162

Merged
merged 5 commits into from
Jan 3, 2024

Conversation

peterfox
Copy link
Collaborator

@peterfox peterfox commented Jan 1, 2024

Changes

  • Adds the new rule to replace expectsJobs and expectsEvents.
  • Adds tests
  • Updates docs
  • Updates the Laravel100 config to include the new rule

Why

It's mentioned in the Laravel Upgrade guides and this rule is quite useful in that it will insert the assertions at the end of the tests' method statements as the best way of handling this change via Rector.

Notes

I can't make this work for expectsNotifications as notification assertions require the notifiable to be checked and as there is no way to know the context of that from a test, only the jobs and events can be handled properly via Rector. The closest guess would be to use assertSentTimes and put 1 as a default which if that's the case it would be best done with an additional rule.

@driftingly
Copy link
Owner

I've pulled in the latest changes to main here. Updates to coding style and GitHub actions.

@driftingly driftingly merged commit b66b04d into driftingly:main Jan 3, 2024
5 checks passed
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.

2 participants