Download the PHP package unicorn/lumen-testbench without Composer

On this page you can find all versions of the php package unicorn/lumen-testbench. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lumen-testbench

Laravel Testing Helper for Packages Development

Testbench Component is a simple package that has been designed to help you write tests for your Laravel package, especially when there is routing involved.

Build Status Latest Stable Version Total Downloads License

Version Compatibility

Laravel Testbench
5.0.x 3.0.x
5.1.x 3.1.x
5.2.x 3.2.x
5.3.x 3.3.x
5.4.x 3.4.x
5.5.x 3.5.x
5.6.x 3.6.x
5.7.x 3.7.x
5.8.x 3.8.x
6.x 4.x
7.x 5.x
8.x@dev 6.x@dev

Getting Started

Before going through the rest of this documentation, please take some time to read the Package Development section of Laravel's own documentation, if you haven't done so yet.

Installation

To install through composer, run the following command from terminal:

composer require --dev "orchestra/testbench"

Usage

To use Testbench Component, all you need to do is extend Orchestra\Testbench\TestCase instead of PHPUnit\Framework\TestCase. The fixture app booted by Orchestra\Testbench\TestCase is predefined to follow the base application skeleton of Laravel 6.

Custom Service Provider

To load your package service provider, override the getPackageProviders.

Custom Aliases

To load your package alias, override the getPackageAliases.

Overriding setUp() method

Since Orchestra\Testbench\TestCase replace Laravel's Illuminate\Foundation\Testing\TestCase, if you need your own setUp() implementation, do not forget to call parent::setUp():

Setup Environment

If you need to add something early in the application bootstrapping process (which executed between registering service providers and booting service providers) you could use the getEnvironmentSetUp() method:

Setup Environment using Annotation

New in Testbench Core 4.4 is the ability to use @environment-setup annotation to customise use of getEnvironmentSetUp specific for each test.

Memory SQLite Connection

To reduce setup configuration, you could use testing database connection (:memory: with sqlite driver) via setting it up under getEnvironmentSetUp() or by defining it under PHPUnit Configuration File:

Overriding Console Kernel

You can easily swap Console Kernel for application bootstrap by overriding resolveApplicationConsoleKernel() method:

Overriding HTTP Kernel

You can easily swap HTTP Kernel for application bootstrap by overriding resolveApplicationHttpKernel() method:

Overriding Application Timezone

You can also easily override application default timezone, instead of the default "UTC":

Using Migrations

Package developer should be using ServiceProvider::loadMigrationsFrom() feature to automatically handle migrations for packages.

Using Laravel Migrations

By default Testbench doesn't execute the default Laravel migrations which include users and password_resets table. In order to run the migration just add the following command:

You can also set specific database connection to be used by adding --database options:

Running Testing Migrations

To run migrations that are only used for testing purposes and not part of your package, add the following to your base test class:

Notes and Considerations

Using Model Factories

Testbench include withFactories() method to allow you to register custom model factory path for your test suite.

Example

To see a working example of testbench including how to set your configuration, check the file:

Alternative Testing

There also 3rd party packages that extends Testbench:

Troubleshoot

No supported encrypter found. The cipher and / or key length are invalid.

RuntimeException: No supported encrypter found. The cipher and / or key length are invalid.

This error would only occur if your test suite require usages of the encrypter. To solve this you can add a dummy APP_KEY or use a specific key to your application/package phpunit.xml.

Why Testbench doesn't include any of the App classes.

The reason Testbench remove all the classes is to make sure that you would never depends on it when developing Laravel Packages. Classes such as App\Http\Controllers\Controller and App\User are simple to be added but the problems with these classes is that it can be either:

Class 'GuzzleHttp\Client' not found

If you plan to use the new HTTP Client in Laravel 7, you need to include guzzlehttp/guzzle to your package's composer.json:

composer require "guzzlehttp/guzzle=^6.3.1"

We can't guarantee that any requirements in laravel/laravel will always be maintained as it is. Developer may remove any of the optional requirements such as guzzlehttp/guzzle, fideloper/proxy, fruitcake/laravel-cors or laravel/tinker.

Missing Browser Kit support after testing on Laravel 5.4

Replace orchestra/testbench with orchestra/testbench-browser-kit and follow the installation guide.


All versions of lumen-testbench with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
laravel/framework Version ^6.4
mockery/mockery Version ^1.2.3
orchestra/testbench-core Version ^4.3
phpunit/phpunit Version ^8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package unicorn/lumen-testbench contains the following files

Loading the files please wait ....