Open olivernybroe opened 4 years ago
This will be a problem to tackle:
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