![]() ![]() ![]() ĪssertResponseHeaderSame(string $headerName, string $expectedValue, string $message = '')/ assertResponseHeaderNotSame(string $headerName, string $expectedValue, string $message = '')Īsserts the given header does (not) contain the expected value on the When mocking an object that is going to be injected into your application via Laravel's service container, you will need to bind your mocked instance into the container as an instance binding.Response Assertions assertResponseIsSuccessful(string $message = '')Īsserts that the response was successful (HTTP status is 2xx).ĪssertResponseStatusCodeSame(int $expectedCode, string $message = '')ĪssertResponseRedirects(string $expectedLocation = null, int $expectedCode = null, string $message = '')Īsserts the response is a redirect response (optionally, you can checkĪssertResponseHasHeader(string $headerName, string $message = '')/ assertResponseNotHasHeader(string $headerName, string $message = '')Īsserts the given header is (not) available on the response, e.g. These helpers primarily provide a convenience layer over Mockery so you do not have to manually make complicated Mockery method calls. Laravel provides helpful methods for mocking events, jobs, and other facades out of the box. This allows you to only test the controller's HTTP response without worrying about the execution of the event listeners since the event listeners can be tested in their own test case. For example, when testing a controller that dispatches an event, you may wish to mock the event listeners so they are not actually executed during the test. When testing Laravel applications, you may wish to "mock" certain aspects of your application so they are not actually executed during a given test.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |