class TestCase extends PHPUnit_Framework_TestCase (View source)

Traits

Methods

$this
visit( string $uri)

Visit the given URI with a GET request.

$this
within( string $element, Closure $callback)

Narrow the test content to a specific area of the page.

$this
see( string $text, bool $negate = false)

Assert that a given string is seen on the current HTML.

$this
dontSee( string $text)

Assert that a given string is not seen on the current HTML.

$this
seeElement( string $selector, array $attributes = array(), bool $negate = false)

Assert that an element is present on the page.

$this
dontSeeElement( string $selector, array $attributes = array())

Assert that an element is not present on the page.

$this
seeText( string $text, bool $negate = false)

Assert that a given string is seen on the current text.

$this
dontSeeText( string $text)

Assert that a given string is not seen on the current text.

$this
seeInElement( string $element, string $text, bool $negate = false)

Assert that a given string is seen inside an element.

$this
dontSeeInElement( string $element, string $text)

Assert that a given string is not seen inside an element.

$this
seeLink( string $text, string|null $url = null, bool $negate = false)

Assert that a given link is seen on the page.

$this
dontSeeLink( string $text, string|null $url = null)

Assert that a given link is not seen on the page.

$this
seeInField( string $selector, string $expected, bool $negate = false)

Assert that an input field contains the given value.

$this
dontSeeInField( string $selector, string $value)

Assert that an input field does not contain the given value.

$this
seeIsSelected( string $selector, string $value, bool $negate = false)

Assert that the expected value is selected.

$this
dontSeeIsSelected( string $selector, string $value)

Assert that the given value is not selected.

$this
seeIsChecked( string $selector, bool $negate = false)

Assert that the given checkbox is selected.

$this
dontSeeIsChecked( string $selector)

Assert that the given checkbox is not selected.

$this
withoutMiddleware()

Disable middleware for the test.

$this
json( string $method, string $uri, array $data = array(), array $headers = array())

Visit the given URI with a JSON request.

$this
get( string $uri, array $headers = array())

Visit the given URI with a GET request.

$this
post( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a POST request.

$this
put( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a PUT request.

$this
patch( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a PATCH request.

$this
delete( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a DELETE request.

$this
handle( Request $request)

Send the given request through the application.

$this
seeJsonEquals( array $data)

Assert that the response contains an exact JSON array.

$this
seeJson( array $data = null, bool $negate = false)

Assert that the response contains JSON.

$this
dontSeeJson( array $data = null)

Assert that the response doesn't contain JSON.

$this
seeJsonStructure( array $structure = null, array|null $responseData = null)

Assert that the JSON response has a given structure.

call( string $method, string $uri, array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call the given URI and return the Response.

callSecure( string $method, string $uri, array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call the given HTTPS URI and return the Response.

action( string $method, string $action, array $wildcards = array(), array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call a controller action and return the Response.

route( string $method, string $name, array $routeParameters = array(), array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call a named route and return the Response.

void
assertResponseOk()

Assert that the client response has an OK status code.

void
assertResponseStatus( int $code)

Assert that the client response has a given code.

void
assertViewHas( string|array $key, mixed $value = null)

Assert that the response view has a given piece of bound data.

void
assertViewHasAll( array $bindings)

Assert that the view has a given list of bound data.

void
assertViewMissing( string $key)

Assert that the response view is missing a piece of bound data.

void
assertRedirectedTo( string $uri, array $with = array())

Assert whether the client was redirected to a given URI.

void
assertRedirectedToRoute( string $name, array $parameters = array(), array $with = array())

Assert whether the client was redirected to a given route.

void
assertRedirectedToAction( string $name, array $parameters = array(), array $with = array())

Assert whether the client was redirected to a given action.

void
dump()

Dump the content from the last response.

$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
seeIsAuthenticated( string|null $guard = null)

Assert that the user is authenticated.

$this
dontSeeIsAuthenticated( string|null $guard = null)

Assert that the user is not authenticated.

$this
seeIsAuthenticatedAs($user, string|null $guard = null)

Assert that the user is authenticated as the given user.

$this
seeCredentials( array $credentials, string|null $guard = null)

Assert that the given credentials are valid.

$this
dontSeeCredentials( array $credentials, string|null $guard = null)

Assert that the given credentials are invalid.

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

Call artisan command and return code.

void
seed( string $class = 'DatabaseSeeder')

Seed a given database connection.

$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.

void
seeInSession( string|array $key, mixed $value = null)

Assert that the session has a given value.

void
assertSessionHas( string|array $key, mixed $value = null)

Assert that the session has a given value.

void
assertSessionHasAll( array $bindings)

Assert that the session has a given list of values.

void
assertSessionMissing( string|array $key)

Assert that the session does not have a given key.

void
assertSessionHasErrors( string|array $bindings = array(), mixed $format = null)

Assert that the session has errors bound.

void
assertHasOldInput()

Assert that the session has old input.

$this
expectsEvents( array|string $events)

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

$this
doesntExpectEvents( array|string $events)

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

$this
withoutObservers( array|string $observers)

Specify a list of observers that will not run for the given operation.

HttpKernelInterface
createApplication()

Creates the application.

Details

$this visit( string $uri)

Visit the given URI with a GET request.

Parameters

string $uri

Return Value

$this

$this within( string $element, Closure $callback)

Narrow the test content to a specific area of the page.

Parameters

string $element
Closure $callback

Return Value

$this

$this see( string $text, bool $negate = false)

Assert that a given string is seen on the current HTML.

Parameters

string $text
bool $negate

Return Value

$this

$this dontSee( string $text)

Assert that a given string is not seen on the current HTML.

Parameters

string $text

Return Value

$this

$this seeElement( string $selector, array $attributes = array(), bool $negate = false)

Assert that an element is present on the page.

Parameters

string $selector
array $attributes
bool $negate

Return Value

$this

$this dontSeeElement( string $selector, array $attributes = array())

Assert that an element is not present on the page.

Parameters

string $selector
array $attributes

Return Value

$this

$this seeText( string $text, bool $negate = false)

Assert that a given string is seen on the current text.

Parameters

string $text
bool $negate

Return Value

$this

$this dontSeeText( string $text)

Assert that a given string is not seen on the current text.

Parameters

string $text

Return Value

$this

$this seeInElement( string $element, string $text, bool $negate = false)

Assert that a given string is seen inside an element.

Parameters

string $element
string $text
bool $negate

Return Value

$this

$this dontSeeInElement( string $element, string $text)

Assert that a given string is not seen inside an element.

Parameters

string $element
string $text

Return Value

$this

Assert that a given link is seen on the page.

Parameters

string $text
string|null $url
bool $negate

Return Value

$this

Assert that a given link is not seen on the page.

Parameters

string $text
string|null $url

Return Value

$this

$this seeInField( string $selector, string $expected, bool $negate = false)

Assert that an input field contains the given value.

Parameters

string $selector
string $expected
bool $negate

Return Value

$this

$this dontSeeInField( string $selector, string $value)

Assert that an input field does not contain the given value.

Parameters

string $selector
string $value

Return Value

$this

$this seeIsSelected( string $selector, string $value, bool $negate = false)

Assert that the expected value is selected.

Parameters

string $selector
string $value
bool $negate

Return Value

$this

$this dontSeeIsSelected( string $selector, string $value)

Assert that the given value is not selected.

Parameters

string $selector
string $value

Return Value

$this

$this seeIsChecked( string $selector, bool $negate = false)

Assert that the given checkbox is selected.

Parameters

string $selector
bool $negate

Return Value

$this

$this dontSeeIsChecked( string $selector)

Assert that the given checkbox is not selected.

Parameters

string $selector

Return Value

$this

$this withoutMiddleware()

Disable middleware for the test.

Return Value

$this

$this json( string $method, string $uri, array $data = array(), array $headers = array())

Visit the given URI with a JSON request.

Parameters

string $method
string $uri
array $data
array $headers

Return Value

$this

$this get( string $uri, array $headers = array())

Visit the given URI with a GET request.

Parameters

string $uri
array $headers

Return Value

$this

$this post( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a POST request.

Parameters

string $uri
array $data
array $headers

Return Value

$this

$this put( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a PUT request.

Parameters

string $uri
array $data
array $headers

Return Value

$this

$this patch( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a PATCH request.

Parameters

string $uri
array $data
array $headers

Return Value

$this

$this delete( string $uri, array $data = array(), array $headers = array())

Visit the given URI with a DELETE request.

Parameters

string $uri
array $data
array $headers

Return Value

$this

$this handle( Request $request)

Send the given request through the application.

This method allows you to fully customize the entire Request object.

Parameters

Request $request

Return Value

$this

$this seeJsonEquals( array $data)

Assert that the response contains an exact JSON array.

Parameters

array $data

Return Value

$this

$this seeJson( array $data = null, bool $negate = false)

Assert that the response contains JSON.

Parameters

array $data
bool $negate

Return Value

$this

$this dontSeeJson( array $data = null)

Assert that the response doesn't contain JSON.

Parameters

array $data

Return Value

$this

$this seeJsonStructure( array $structure = null, array|null $responseData = null)

Assert that the JSON response has a given structure.

Parameters

array $structure
array|null $responseData

Return Value

$this

Response call( string $method, string $uri, array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call the given URI and return the Response.

Parameters

string $method
string $uri
array $parameters
array $cookies
array $files
array $server
string $content

Return Value

Response

Response callSecure( string $method, string $uri, array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call the given HTTPS URI and return the Response.

Parameters

string $method
string $uri
array $parameters
array $cookies
array $files
array $server
string $content

Return Value

Response

Response action( string $method, string $action, array $wildcards = array(), array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call a controller action and return the Response.

Parameters

string $method
string $action
array $wildcards
array $parameters
array $cookies
array $files
array $server
string $content

Return Value

Response

Response route( string $method, string $name, array $routeParameters = array(), array $parameters = array(), array $cookies = array(), array $files = array(), array $server = array(), string $content = null)

Call a named route and return the Response.

Parameters

string $method
string $name
array $routeParameters
array $parameters
array $cookies
array $files
array $server
string $content

Return Value

Response

void assertResponseOk()

Assert that the client response has an OK status code.

Return Value

void

void assertResponseStatus( int $code)

Assert that the client response has a given code.

Parameters

int $code

Return Value

void

void assertViewHas( string|array $key, mixed $value = null)

Assert that the response view has a given piece of bound data.

Parameters

string|array $key
mixed $value

Return Value

void

void assertViewHasAll( array $bindings)

Assert that the view has a given list of bound data.

Parameters

array $bindings

Return Value

void

void assertViewMissing( string $key)

Assert that the response view is missing a piece of bound data.

Parameters

string $key

Return Value

void

void assertRedirectedTo( string $uri, array $with = array())

Assert whether the client was redirected to a given URI.

Parameters

string $uri
array $with

Return Value

void

void assertRedirectedToRoute( string $name, array $parameters = array(), array $with = array())

Assert whether the client was redirected to a given route.

Parameters

string $name
array $parameters
array $with

Return Value

void

void assertRedirectedToAction( string $name, array $parameters = array(), array $with = array())

Assert whether the client was redirected to a given action.

Parameters

string $name
array $parameters
array $with

Return Value

void

void dump()

Dump the content from the last response.

Return Value

void

$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

$this seeIsAuthenticated( string|null $guard = null)

Assert that the user is authenticated.

Parameters

string|null $guard

Return Value

$this

$this dontSeeIsAuthenticated( string|null $guard = null)

Assert that the user is not authenticated.

Parameters

string|null $guard

Return Value

$this

$this seeIsAuthenticatedAs($user, string|null $guard = null)

Assert that the user is authenticated as the given user.

Parameters

$user
string|null $guard

Return Value

$this

$this seeCredentials( array $credentials, string|null $guard = null)

Assert that the given credentials are valid.

Parameters

array $credentials
string|null $guard

Return Value

$this

$this dontSeeCredentials( array $credentials, string|null $guard = null)

Assert that the given credentials are invalid.

Parameters

array $credentials
string|null $guard

Return Value

$this

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

Call artisan command and return code.

Parameters

string $command
array $parameters

Return Value

int

void seed( string $class = 'DatabaseSeeder')

Seed a given database connection.

Parameters

string $class

Return Value

void

$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

void seeInSession( string|array $key, mixed $value = null)

Assert that the session has a given value.

Parameters

string|array $key
mixed $value

Return Value

void

void assertSessionHas( string|array $key, mixed $value = null)

Assert that the session has a given value.

Parameters

string|array $key
mixed $value

Return Value

void

void assertSessionHasAll( array $bindings)

Assert that the session has a given list of values.

Parameters

array $bindings

Return Value

void

void assertSessionMissing( string|array $key)

Assert that the session does not have a given key.

Parameters

string|array $key

Return Value

void

void assertSessionHasErrors( string|array $bindings = array(), mixed $format = null)

Assert that the session has errors bound.

Parameters

string|array $bindings
mixed $format

Return Value

void

void assertHasOldInput()

Assert that the session has old input.

Return Value

void

$this expectsEvents( array|string $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|string $events

Return Value

$this

Exceptions

Exception

$this doesntExpectEvents( array|string $events)

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

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

Parameters

array|string $events

Return Value

$this

$this withoutObservers( array|string $observers)

Specify a list of observers that will not run for the given operation.

Parameters

array|string $observers

Return Value

$this

at line line 55
abstract HttpKernelInterface createApplication()

Creates the application.

Needs to be implemented by subclasses.

Return Value

HttpKernelInterface