PHPackages                             anik/testbench-lumen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. anik/testbench-lumen

ActiveLibrary[Testing &amp; Quality](/categories/testing)

anik/testbench-lumen
====================

Testing Helper for Lumen package development

v2.0(3y ago)77.2k↑40%3MITPHPPHP ^7.2|^8.0

Since Apr 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ssi-anik/testbench-lumen)[ Packagist](https://packagist.org/packages/anik/testbench-lumen)[ RSS](/packages/anik-testbench-lumen/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (6)Used By (3)

testbench-lumen [![codecov](https://camo.githubusercontent.com/875f1df1c181393d2050ac0a5baed863e0be33ad4e3a1a8658dfcff5898fa0c4/68747470733a2f2f636f6465636f762e696f2f67682f7373692d616e696b2f7465737462656e63682d6c756d656e2f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d3134414a49485558474b)](https://codecov.io/gh/ssi-anik/testbench-lumen)[![Total Downloads](https://camo.githubusercontent.com/138518ea72a22d1992f4110141639ed416774703313d4ed46568f6fdc4eb8bd1/68747470733a2f2f706f7365722e707567782e6f72672f616e696b2f7465737462656e63682d6c756d656e2f646f776e6c6f616473)](//packagist.org/packages/anik/testbench-lumen)[![Latest Stable Version](https://camo.githubusercontent.com/1e4e221d156d02a11a1330f66bf801324b6bc4f063afa1311972c9ca82fe2784/68747470733a2f2f706f7365722e707567782e6f72672f616e696b2f7465737462656e63682d6c756d656e2f76)](//packagist.org/packages/anik/testbench-lumen)
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#testbench-lumen)

`anik/testbench-lumen` is a package, highly inspired by the [orchestral/testbench](https://github.com/orchestral/testbench). `orchestral/testbench` that is a tool for testing Laravel packages. Whereas the `anik/testbench-lumen` can only be used with [Lumen](https://github.com/laravel/lumen), starting from Lumen `6.x` and afterwards.

Installation
------------

[](#installation)

```
composer require --dev anik/testbench-lumen
```

Documentation
-------------

[](#documentation)

- The package uses the `phpunit.xml`. Set up your environment variables in the `phpunit.xml` file.

```

    // ...

```

**NOTE**: The package **doesn't** use the `.env` file. You'll have to primarily set all your variables in your `phpunit.xml` file.

- Your testcases should extend the `\Anik\Testbench\TestCase` class.
- Your testcases will have access to the [Lumen testing APIs](https://lumen.laravel.com/docs/master/testing).

### Bootstrapping

[](#bootstrapping)

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 `[]`.

```
