Rightly or wrongly, I'm using a signedRoute in my users.update route to protect users modifying the user id of the edit user form. Please tell me if that is bad news and tell me another way around it if possible.
Anyway, as a result when I write a test I get a BadMethodCallException: Method Illuminate\Support\Arr::query does not exist. error and I don't why. Can someone help me:
Test
use Illuminate\Support\Facades\URL;
class UserTest extends TestCase
{
function adminCanChangeUserStatus()
{
$this->withoutExceptionHandling();
// hard coded user and fail() method for debug
$this->fail(URL::signedRoute('users.update', ['user' => 9]));
}
}
Routes
Route::group(['middleware' => ['auth']], function () {
....
Route::post('users/{user}', 'UserController@update')->name('users.update');
....
});
UserController
public function update(User $user)
{
abort_if(!request()->hasValidSignature(), 401);
...
}
When I run the test above it throws the following stack trace:
BadMethodCallException: Method Illuminate\Support\Arr::query does not exist.
C:\Users\USERNAME\AppData\Roaming\Composer\vendor\illuminate\support\Traits\Macroable.php:75
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\RouteUrlGenerator.php:268
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\RouteUrlGenerator.php:247
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\RouteUrlGenerator.php:88
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:428
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:409
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:333
C:\laragon\www\sitename\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:239
C:\laragon\www\sitename\tests\Feature\UserTest.php:92
C:\Users\USERNAME\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:200
C:\Users\USERNAME\AppData\Roaming\Composer\vendor\phpunit\phpunit\src\TextUI\Command.php:159