albertcht / lumen-testing
Testing Suite For Lumen like Laravel does.
Installs: 32 469
Dependents: 1
Suggesters: 0
Security: 0
Stars: 43
Watchers: 5
Forks: 24
Open Issues: 8
Requires
- php: ^7.1
- laravel/lumen-framework: ~5.3|~6.0
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.0
README
Description
A testing suite for Lumen like Laravel does.
Requirements
- >= PHP 7.1
- >= Lumen 5.3
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
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 useRefreshDatabase
, you don't need to use the other two traits anymore.
Response Assertions
Laravel provides a variety of custom assertion methods for your PHPUnit tests. These assertions may be accessed on the response that is returned from the json
, get
, post
, put
, and delete
test methods:
Authentication Assertions
Laravel also provides a variety of authentication related assertions for your PHPUnit tests:
Database Assertions
Laravel provides several database assertions for your PHPUnit tests:
Reference
See full document at Laravel's doc:
Support on Beerpay
Hey dude! Help me out for a couple of 🍻!