albertcht/lumen-testing

Testing Suite For Lumen like Laravel does.

v1.1 2019-12-01 09:49 UTC

This package is auto-updated.

Last update: 2024-12-11 17:12:12 UTC


README

php-badge packagist-badge Total Downloads travis-badge

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 use RefreshDatabase, 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 🍻!

Beerpay Beerpay