You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.
Let's create a new rector which can migrate a pest test into a higher order test.
The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.
Warning: You can't access runtime helpers in Laravel, like route, with higher-order tests.
Let's say you want to refactor this test to use Higher Order Functions:
test('has home page', function () {
$this->get(route('home'))
->assertSuccessful();
});
It is using a named route, home, which you can't access with the arrow function syntax.
So you'd need to replace that call to route() with the actual route segment, like so:
test('has home page')->get('/')->assertSuccessful();
Let's create a new rector which can migrate a pest test into a higher order test.
The reason for using a new rector is so we can optionally enable/disable it and decouple it from the base rector which is about just refactoring to pest test cases, not making them nicer.
Pest Docs
The text was updated successfully, but these errors were encountered: