PHPackages                             unicorn/lumen-testing - 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. unicorn/lumen-testing

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

unicorn/lumen-testing
=====================

Testing Suite For Lumen like Laravel does.

v1.0(6y ago)02.2k1MITPHPPHP ^7.1

Since Dec 30Pushed 6y agoCompare

[ Source](https://github.com/UnicornGlobal/lumen-testing)[ Packagist](https://packagist.org/packages/unicorn/lumen-testing)[ RSS](/packages/unicorn-lumen-testing/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (13)Used By (0)

Lumen Testing
=============

[](#lumen-testing)

[![php-badge](https://camo.githubusercontent.com/44b4168992cad8cfdb2412840a91b77b343bce03ee5ccbc4b5c9171dd70a99b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c626572746368742f6c756d656e2d74657374696e672e737667)](https://camo.githubusercontent.com/44b4168992cad8cfdb2412840a91b77b343bce03ee5ccbc4b5c9171dd70a99b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c626572746368742f6c756d656e2d74657374696e672e737667)[![packagist-badge](https://camo.githubusercontent.com/fefad3fc7693c4a101f941012ccb28cf58b0bd41f327f0df367a90b7bc9584f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c626572746368742f6c756d656e2d74657374696e672e737667)](https://packagist.org/packages/albertcht/lumen-testing)[![Total Downloads](https://camo.githubusercontent.com/dd2779636602eb5e123af333681257467cd14e18b3c4ce220332441f63ddb455/68747470733a2f2f706f7365722e707567782e6f72672f616c626572746368742f6c756d656e2d74657374696e672f646f776e6c6f616473)](https://packagist.org/packages/albertcht/lumen-testing)[![travis-badge](https://camo.githubusercontent.com/6ad599a8f232f786872d594d770e1cc10b3b6569476380a838a2a7d6a558aa74/68747470733a2f2f6170692e7472617669732d63692e6f72672f616c626572746368742f6c756d656e2d74657374696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/albertcht/lumen-testing)

Description
-----------

[](#description)

A testing suite for Lumen like Laravel does.

### Requirements

[](#requirements)

- &gt;= PHP 7.1
- &gt;= Lumen 5.3

### Installation

[](#installation)

```
composer require --dev albertcht/lumen-testing

```

- Make your test case extend `AlbertCht\Lumen\Testing\TestCase`

You're all done! Enjoy your testing like in Laravel!

### Concerns

[](#concerns)

There are some traits you can use in your test case (including original ones in Lumen):

- `AlbertCht\Lumen\Testing\Concerns\RefreshDatabase`
- `AlbertCht\Lumen\Testing\Concerns\WithFaker`
- `AlbertCht\Lumen\Testing\Concerns\InteractsWithRedis`
- `AlbertCht\Lumen\Testing\Concerns\InteractsWithConsole`
- `AlbertCht\Lumen\Testing\Concerns\InteractsWithContainer`
- `Laravel\Lumen\Testing\DatabaseMigrations`
- `Laravel\Lumen\Testing\DatabaseTransactions`
- `Laravel\Lumen\Testing\WithoutMiddleware`
- `Laravel\Lumen\Testing\WithoutEvents`

> `RefreshDatabase` = `DatabaseMigrations` + `DatabaseTransactions`, so if you use `RefreshDatabase`, you don't need to use the other two traits anymore.

### Response Assertions

[](#response-assertions)

Laravel provides a variety of custom assertion methods for your [PHPUnit](https://phpunit.de/) tests. These assertions may be accessed on the response that is returned from the `json`, `get`, `post`, `put`, and `delete` test methods:

MethodDescription`$response->assertSuccessful();`Assert that the response has a successful status code.`$response->assertStatus($code);`Assert that the response has a given code.`$response->assertRedirect($uri);`Assert that the response is a redirect to a given URI.`$response->assertHeader($headerName, $value = null);`Assert that the given header is not present on the response.`$response->assertHeaderMissing($headerName);`Assert that the given header is present on the response.`$response->assertCookie($cookieName, $value = null);`Assert that the response contains the given cookie.`$response->assertPlainCookie($cookieName, $value = null);`Assert that the response contains the given cookie (unencrypted).`$response->assertCookieExpired($cookieName);`Assert that the response contains the given cookie and it is expired.`$response->assertCookieNotExpired($cookieName);`Assert that the response contains the given cookie and it is not expired.`$response->assertCookieMissing($cookieName);`Assert that the response does not contains the given cookie.`$response->assertJson(array $data);`Assert that the response contains the given JSON data.`$response->assertJsonCount(int $count, $key = null);`Assert that the response JSON has the expected count of items at the given key.`$response->assertJsonFragment(array $data);`Assert that the response contains the given JSON fragment.`$response->assertJsonMissing(array $data);`Assert that the response does not contain the given JSON fragment.`$response->assertJsonMissingExact(array $data);`Assert that the response does not contain the exact JSON fragment.`$response->assertExactJson(array $data);`Assert that the response contains an exact match of the given JSON data.`$response->assertJsonStructure(array $structure);`Assert that the response has a given JSON structure.`$response->assertJsonValidationErrors($keys);`Assert that the response has the given JSON validation errors for the given keys.`$response->assertViewIs($value);`Assert that the given view was returned by the route.`$response->assertViewHas($key, $value = null);`Assert that the response view was given a piece of data.`$response->assertViewHasAll(array $data);`Assert that the response view has a given list of data.`$response->assertViewMissing($key);`Assert that the response view is missing a piece of bound data.`$response->assertSee($value);`Assert that the given string is contained within the response.`$response->assertDontSee($value);`Assert that the given string is not contained within the response.`$response->assertSeeText($value);`Assert that the given string is contained within the response text.`$response->assertDontSeeText($value);`Assert that the given string is not contained within the response text.`$response->assertSeeInOrder(array $values);`Assert that the given strings are contained in order within the response.`$response->assertSeeTextInOrder(array $values);`Assert that the given strings are contained in order within the response text.### Authentication Assertions

[](#authentication-assertions)

Laravel also provides a variety of authentication related assertions for your [PHPUnit](https://phpunit.de/) tests:

MethodDescription`$this->assertAuthenticated($guard = null);`Assert that the user is authenticated.`$this->assertGuest($guard = null);`Assert that the user is not authenticated.`$this->assertAuthenticatedAs($user, $guard = null);`Assert that the given user is authenticated.`$this->assertCredentials(array $credentials, $guard = null);`Assert that the given credentials are valid.`$this->assertInvalidCredentials(array $credentials, $guard = null);`Assert that the given credentials are invalid.Database Assertions
-------------------

[](#database-assertions)

Laravel provides several database assertions for your [PHPUnit](https://phpunit.de/) tests:

MethodDescription`$this->assertDatabaseHas($table, array $data);`Assert that a table in the database contains the given data.`$this->assertDatabaseMissing($table, array $data);`Assert that a table in the database does not contain the given data.`$this->assertSoftDeleted($table, array $data);`Assert that the given record has been soft deleted.### Reference

[](#reference)

See full document at Laravel's doc:

-
-

Support on Beerpay
------------------

[](#support-on-beerpay)

Hey dude! Help me out for a couple of 🍻!

[![Beerpay](https://camo.githubusercontent.com/64e158f58daee930ea807ede9c33e2f11fcb0d7b665eab0dc86ac979e656be8f/68747470733a2f2f626565727061792e696f2f616c626572746368742f6c756d656e2d74657374696e672f62616467652e7376673f7374796c653d626565722d737175617265)](https://beerpay.io/albertcht/lumen-testing) [![Beerpay](https://camo.githubusercontent.com/812e0037ba2e47c95ee48fd8442b182ac6ad98095c70aaf2354cb212097c8cf4/68747470733a2f2f626565727061792e696f2f616c626572746368742f6c756d656e2d74657374696e672f6d616b652d776973682e7376673f7374796c653d666c61742d737175617265)](https://beerpay.io/albertcht/lumen-testing?focus=wish)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~71 days

Recently: every ~108 days

Total

10

Last Release

2419d ago

Major Versions

v0.9 → v1.02019-09-29

PHP version history (3 changes)v0.1PHP ^5.6.4 || ^7.0

v0.4PHP ^7.0

v0.7PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8458e77a1e51443980bc078f1df4954070d63d2f98b6174adfb6ce035a05e63f?d=identicon)[darrynten](/maintainers/darrynten)

---

Top Contributors

[![albertcht](https://avatars.githubusercontent.com/u/9117929?v=4)](https://github.com/albertcht "albertcht (39 commits)")[![darrynten](https://avatars.githubusercontent.com/u/3657251?v=4)](https://github.com/darrynten "darrynten (21 commits)")[![realjay007](https://avatars.githubusercontent.com/u/22660815?v=4)](https://github.com/realjay007 "realjay007 (7 commits)")[![steveops](https://avatars.githubusercontent.com/u/12711215?v=4)](https://github.com/steveops "steveops (7 commits)")[![HenkPoley](https://avatars.githubusercontent.com/u/2931213?v=4)](https://github.com/HenkPoley "HenkPoley (2 commits)")[![zimo-xiao](https://avatars.githubusercontent.com/u/34933627?v=4)](https://github.com/zimo-xiao "zimo-xiao (2 commits)")[![zchlm](https://avatars.githubusercontent.com/u/8256446?v=4)](https://github.com/zchlm "zchlm (2 commits)")[![stevethomas](https://avatars.githubusercontent.com/u/1127412?v=4)](https://github.com/stevethomas "stevethomas (1 commits)")[![optiman](https://avatars.githubusercontent.com/u/2707476?v=4)](https://github.com/optiman "optiman (1 commits)")

---

Tags

testingphpunittestlaravellumen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/unicorn-lumen-testing/health.svg)

```
[![Health](https://phpackages.com/badges/unicorn-lumen-testing/health.svg)](https://phpackages.com/packages/unicorn-lumen-testing)
```

###  Alternatives

[albertcht/lumen-testing

Testing Suite For Lumen like Laravel does.

4335.5k1](/packages/albertcht-lumen-testing)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[fr3d/swagger-assertions

Test your API requests and responses against your swagger definition

138850.9k5](/packages/fr3d-swagger-assertions)[sofa/eloquent-testsuite

Helpers for fast and reliable UNIT tests for your Eloquent Models with PHPUnit

10104.7k](/packages/sofa-eloquent-testsuite)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
