What is the proper syntax for "shouldReceive" with Laravel View class and the "with" argument? I have been trying all morning to let this simple test pass:
$request = new Request([], [], [], [], []);
$view = Mockery::mock(View::class);
$dealData = [
'products' => [],
'response' => [
'total' => 100
],
'aggs' => []
];
$pageData = [
'productData' => $dealData
];
$this->productService->shouldReceive('getDealsListData');
$view->shouldReceive('with')->with($pageData);
$this->productController->getDealsList($request);
The method I'm testing calls out to productService and then returns a view with arguments:
return view('products.list')->with($pageData);
Seemingly no matter what combination I try this is the output from phpunit:
Received Mockery_4_Illuminate_View_View::with(), but no expectations were specified
I am explicitly saying it shouldReceive "with" -- what can I do to allow phpunit to pass here?