anik/testbench-lumen is a package, highly inspired by the orchestral/testbench. orchestral/testbench that is a tool for testing Laravel packages. Whereas the anik/testbench-lumen can only be used with Lumen, starting from Lumen 6.x and afterwards.
Installation
composer require anik/testbench-lumen
Docs
The package uses the phpunit.xml. Set up your environment variables in the phpunit.xml file.
The package internally boots the Lumen application for the test cases. While bootstrapping, you can add some functionalities.
afterApplicationCreated($callback) registers the callbacks that will be called after the application is created. If you register the callback after the application is created, it'll be fired immediately. The callback will access to the Laravel\Lumen\Application instance.
afterApplicationRefreshed($callback) registers the callbacks that will be called after the application is refreshed. If you register the callback after the application is refreshed, it'll be fired immediately. The callback will have access to the Laravel\Lumen\Application instance.
beforeApplicationDestroyed($callback) registers the callback that will be called before the application is getting destroyed. Will have access to the Laravel\Lumen\Application instance.
afterApplicationDestroyed($callback) registers the callback that will be called after the application has been destroyed. Will have access to the Laravel\Lumen\Application instance.
The application does not by default loads the facade and eloquent. If you need to enable
Facade, the return true from the withFacade method. Default: false.
Eloquent, the return true from the withEloquent method. Default: false.
To load your required service providers, you can return an array of providers from the serviceProviders() method. Default is [].
To add your middlewares, you can add both the global and route middlewares.
To add global middlewares, you have to return an array of middlewares from the globalMiddlewares method. The method has access to the Laravel\Lumen\Application instance.
To add route middlewares, you have to return an associative array of middlewares from the routeMiddlewares. The method has access to the Laravel\Lumen\Application instance.
By default, the application has the access to the/ endpoint returning the app()->version() as the response. To define your routes for the test purpose, you can use the routes method. The method has access to the Laravel\Lumen\Routing\Router instance. Defining routes in this method is as same as writing methods in the routes/web.php or routes/api.php
If your tests need to perform some sort of actions before running it, i.e. changing environment values, binding something to the container, etc. then you can perform those actions with annotations @setup-before. The annotated tasks are executed in a synchronous manner, and the returned value from the previous task is carried to the next task. Only the method level annotations are executed. The first parameter to the task is the Laravel\Lumen\Application instance, and the second parameters will the returned value from the previous task.
A package for Laravel to perform basic git commands on locally integrated development packages. If working within multiple local development packages or repositories at once this package is meant to ease the burden of navigating to each individual repository to perform basic git commands.
A package built for lumen that ports most of the make commands from laravel. For lumen v5.1, but will most likely work for 5.2 as well. I haven't tested. If you have requests, let me know, or do it yourself and make a pull request
Laravel Package Support for Lumen: Makes Lumen compatible with Laravel Packages. You can use any Laravel Packages in Lumen by installing Larasupport Package.