W3cubDocs

/Laravel 5.3

ApplicationTrait

trait ApplicationTrait (View source)

Methods

$this expectsEvents(array|mixed $events)

Specify a list of events that should be fired for the given operation.

$this withSession(array $data)

Set the session to the given array.

void session(array $data)

Set the session to the given array.

void flushSession()

Flush all of the current session data.

$this withoutMiddleware()

Disable middleware for the test.

$this actingAs(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

void be(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

void seed(string $class = 'DatabaseSeeder')

Seed a given database connection.

int artisan(string $command, array $parameters = array())

Call artisan command and return code.

Details

$this expectsEvents(array|mixed $events)

Specify a list of events that should be fired for the given operation.

These events will be mocked, so that handlers will not actually be executed.

Parameters

array|mixed $events

Return Value

$this

$this withSession(array $data)

Set the session to the given array.

Parameters

array $data

Return Value

$this

void session(array $data)

Set the session to the given array.

Parameters

array $data

Return Value

void

void flushSession()

Flush all of the current session data.

Return Value

void

$this withoutMiddleware()

Disable middleware for the test.

Return Value

$this

$this actingAs(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

Parameters

Authenticatable $user
string|null $driver

Return Value

$this

void be(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

Parameters

Authenticatable $user
string|null $driver

Return Value

void

void seed(string $class = 'DatabaseSeeder')

Seed a given database connection.

Parameters

string $class

Return Value

void

int artisan(string $command, array $parameters = array())

Call artisan command and return code.

Parameters

string $command
array $parameters

Return Value

int

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Foundation/Testing/ApplicationTrait.html