How to mock laravel helper function request

Viewed 1287

How do you mock the request() helper function?

For example if I have a function that makes a call

$name = request()->input('name')

How do mock that call, I have tried the following but I get an error that it was never called

$requestMock = $this->mock(Request::class);
$requestMock->shouldReceive('input')->once()->andReturn($name);
1 Answers
Related