ApplicationTrait
trait ApplicationTrait (View source)
Properties
protected Application | $app | The Illuminate application instance. | |
protected int | $code | The last code returned by Artisan CLI. |
Methods
void | refreshApplication() Refresh the application instance. | |
object | instance(string $abstract, object $instance) Register an instance of an object in the container. | |
$this | expectsEvents(array|mixed $events) Specify a list of events that should be fired for the given operation. | |
$this | withoutEvents() Mock the event dispatcher so all events are silenced. | |
$this | expectsJobs(array|mixed $jobs) Specify a list of jobs that should be dispatched 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 | startSession() Start the session for the application. | |
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. | |
$this | seeInDatabase(string $table, array $data, string $connection = null) Assert that a given where condition exists in the database. | |
$this | missingFromDatabase(string $table, array $data, string $connection = null) Assert that a given where condition does not exist in the database. | |
$this | dontSeeInDatabase(string $table, array $data, string $connection = null) Assert that a given where condition does not exist in the database. | |
$this | notSeeInDatabase(string $table, array $data, string $connection = null) Assert that a given where condition does not exist in the database. | |
void | seed(string $class = 'DatabaseSeeder') Seed a given database connection. | |
int | artisan(string $command, array $parameters = []) Call artisan command and return code. |
Details
protected void refreshApplication()
Refresh the application instance.
protected object instance(string $abstract, object $instance)
Register an instance of an object in the container.
$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.
protected $this withoutEvents()
Mock the event dispatcher so all events are silenced.
protected $this expectsJobs(array|mixed $jobs)
Specify a list of jobs that should be dispatched for the given operation.
These jobs will be mocked, so that handlers will not actually be executed.
$this withSession(array $data)
Set the session to the given array.
void session(array $data)
Set the session to the given array.
protected void startSession()
Start the session for the application.
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.
protected $this seeInDatabase(string $table, array $data, string $connection = null)
Assert that a given where condition exists in the database.
protected $this missingFromDatabase(string $table, array $data, string $connection = null)
Assert that a given where condition does not exist in the database.
protected $this dontSeeInDatabase(string $table, array $data, string $connection = null)
Assert that a given where condition does not exist in the database.
protected $this notSeeInDatabase(string $table, array $data, string $connection = null)
Assert that a given where condition does not exist in the database.
void seed(string $class = 'DatabaseSeeder')
Seed a given database connection.
int artisan(string $command, array $parameters = [])
Call artisan command and return code.
© 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