A couple of weeks ago the Lumen core team managed to fix an issue with the request object when being called in unit tests, before the fix the request appears to be empty and all input data were not present in unit tests.
The problem was related to how Lumen is bootstrapped, simply put, the request was being instantiated as a Singleton too early in the bootstrap sequence. Creating requests in unit tests won’t be able to modify the request object since it’s already instantiated as a Singleton, and that’s why we were unable to reconstruct it for unit tests.
To solve the issue we deferred creating the request instance until the application starts dispatching the request to the router, this is the same approach Laravel follows while bootstrapping.
The issue with this change is that Lumen users will not be able to use the request instance in your Service Providers anymore. That’s because by the time Lumen registers the providers the request object isn’t instantiated yet.
The alternative solution is to copy whatever code you put in your Service Providers that uses the request object, and move it to a global middleware; the middleware will run directly after the request is captured.
Laravel Collections “when” Method
Starting at v5.4.12, Laravel Collections now includes a when method that allows you to perform conditional actions on…
Testing Partial JSON Responses with Laravel
Laravel provides many useful helpers for testing your application and it has great support for testing HTTP testing t…