PHP Class Laravel\Lumen\Testing\TestCase

Inheritance: extends PHPUnit_Framework_TestCas\PHPUnit_Framework_TestCase, use trait Laravel\Lumen\Testing\Concerns\MakesHttpRequests
Show file Open project: laravel/lumen-framework Class Usage Examples

Protected Properties

Property Type Description
$app Laravel\Lumen\Application The application instance.
$baseUrl string The base URL to use while testing the application.
$beforeApplicationDestroyedCallbacks array The callbacks that should be run before the application is destroyed.

Public Methods

Method Description
actingAs ( Illuminate\Contracts\Auth\Authenticatable $user, string | null $driver = null ) Set the currently logged in user for the application.
artisan ( string $command, array $parameters = [] ) : integer Call artisan command and return code.
be ( Illuminate\Contracts\Auth\Authenticatable $user, string | null $driver = null ) : void Set the currently logged in user for the application.
createApplication ( ) : Symfony\Component\HttpKernel\HttpKernelInterface Creates the application.
expectsEvents ( array | string $events ) Specify a list of events that should be fired for the given operation.
setUp ( ) : void Setup the test environment.
tearDown ( ) : void Clean up the testing environment before the next test.

Protected Methods

Method Description
beforeApplicationDestroyed ( callable $callback ) : void Register a callback to be run before the application is destroyed.
expectsJobs ( array | string $jobs ) Specify a list of jobs that should be dispatched for the given operation.
missingFromDatabase ( string $table, array $data, string | null $onConnection = null ) Assert that a given where condition does not exist in the database.
notSeeInDatabase ( string $table, array $data, string | null $onConnection = null ) Assert that a given where condition does not exist in the database.
refreshApplication ( ) : void Refresh the application instance.
seeInDatabase ( string $table, array $data, string | null $onConnection = null ) Assert that a given where condition exists in the database.
setUpTraits ( ) : void Boot the testing helper traits.
withoutEvents ( ) Mock the event dispatcher so all events are silenced.

Method Details

actingAs() public method

Set the currently logged in user for the application.
public actingAs ( Illuminate\Contracts\Auth\Authenticatable $user, string | null $driver = null )
$user Illuminate\Contracts\Auth\Authenticatable
$driver string | null

artisan() public method

Call artisan command and return code.
public artisan ( string $command, array $parameters = [] ) : integer
$command string
$parameters array
return integer

be() public method

Set the currently logged in user for the application.
public be ( Illuminate\Contracts\Auth\Authenticatable $user, string | null $driver = null ) : void
$user Illuminate\Contracts\Auth\Authenticatable
$driver string | null
return void

beforeApplicationDestroyed() protected method

Register a callback to be run before the application is destroyed.
protected beforeApplicationDestroyed ( callable $callback ) : void
$callback callable
return void

createApplication() abstract public method

Needs to be implemented by subclasses.
abstract public createApplication ( ) : Symfony\Component\HttpKernel\HttpKernelInterface
return Symfony\Component\HttpKernel\HttpKernelInterface

expectsEvents() public method

These events will be mocked, so that handlers will not actually be executed.
public expectsEvents ( array | string $events )
$events array | string

expectsJobs() protected method

These jobs will be mocked, so that handlers will not actually be executed.
protected expectsJobs ( array | string $jobs )
$jobs array | string

missingFromDatabase() protected method

Assert that a given where condition does not exist in the database.
protected missingFromDatabase ( string $table, array $data, string | null $onConnection = null )
$table string
$data array
$onConnection string | null

notSeeInDatabase() protected method

Assert that a given where condition does not exist in the database.
protected notSeeInDatabase ( string $table, array $data, string | null $onConnection = null )
$table string
$data array
$onConnection string | null

refreshApplication() protected method

Refresh the application instance.
protected refreshApplication ( ) : void
return void

seeInDatabase() protected method

Assert that a given where condition exists in the database.
protected seeInDatabase ( string $table, array $data, string | null $onConnection = null )
$table string
$data array
$onConnection string | null

setUp() public method

Setup the test environment.
public setUp ( ) : void
return void

setUpTraits() protected method

Boot the testing helper traits.
protected setUpTraits ( ) : void
return void

tearDown() public method

Clean up the testing environment before the next test.
public tearDown ( ) : void
return void

withoutEvents() protected method

Mock the event dispatcher so all events are silenced.
protected withoutEvents ( )

Property Details

$app protected property

The application instance.
protected Application,Laravel\Lumen $app
return Laravel\Lumen\Application

$baseUrl protected property

The base URL to use while testing the application.
protected string $baseUrl
return string

$beforeApplicationDestroyedCallbacks protected property

The callbacks that should be run before the application is destroyed.
protected array $beforeApplicationDestroyedCallbacks
return array