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.
Changes
expectsJobs
andexpectsEvents
.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 useassertSentTimes
and put 1 as a default which if that's the case it would be best done with an additional rule.