In Laravel, Facades are used to provide a static interface to classes available inside the application's service container.

Now, unlike conventional static method calls, facades can be mocked in Laravel. It can be done using the shouldRecieve method, which shall return an instance of a facade mock.

BY Best Interview Question ON 25 Jun 2020

Example

$value = Cache::get('key');

Cache::shouldReceive('get')->once()->with('key')->andReturn('value');

Suggest An Answer