jasonmccreary / laravel-test-assertions

A set of helpful assertions when testing Laravel applications.
321 stars 34 forks source link

Invokable controllers are not compatible with the assertRouteUsesFormRequest method #7

Closed devonmather closed 4 years ago

devonmather commented 4 years ago

I've noticed that the following assertion causes a ErrorException: Undefined offset: 1

$this->assertRouteUsesFormRequest('api.import.csv', ValidateCsvRequest::class);

Looking at the code seems we are only splitting the string on the @ symbol, thus causing the undefined index issue when that @ symbol ins't present when using an __invoke function on a controller as seen here. [$controller, $method] = explode('@', $controllerAction->first());

devonmather commented 4 years ago

Created a PR for it, https://github.com/jasonmccreary/laravel-test-assertions/pull/8

Let me know if further changes are needed to get it merged 👍🏻