How to Mock the Request Class in Laravel?
PHP Snippet 1:
app()->bind(\Illuminate\Http\Request::class, function () {
$mock = \Mockery::mock(\Illuminate\Http\Request::class)->makePartial();
$mock->shouldReceive('all')->andReturn(['includes' => ['some_val','another_val']]);
return $mock;
});
PHP Snippet 2:
public function testPostRequest() {
$response = $this->post(
'/my-custom-route',
['includes' => ['some_val','another_val']]
);
}