/** * Test that you can generate error responses using the facade. * * @test */ public function youCanMakeErrorResponsesUsingFacade() { // Arrange... $responder = $this->mockResponder(); // Expect... $responder->shouldReceive('error')->with('test_error', 400, 'Test error.')->once(); // Act... Responder::error('test_error', 400, 'Test error.'); }
/** * Test that you can access the responder service from the Laravel's IoC container. * * @test */ public function youCanAccessThroughFacade() { // Arrange... $fruit = $this->createModel(); $responder = $this->mockResponder(); // Act... ResponderFacade::success($fruit, 200); // Assert... $responder->shouldHaveReceived('success')->with($fruit, 200); }