TestCase

class TestCase extends PHPUnit_Framework_TestCase (View source)

Traits

ApplicationTrait
AssertionsTrait
CrawlerTrait
InteractsWithPages

Properties

protected Application $app The Illuminate application instance. from ApplicationTrait
protected int $code The last code returned by Artisan CLI. from ApplicationTrait
protected Crawler $crawler The DomCrawler instance. from InteractsWithPages
protected array $inputs All of the stored inputs for the current page. from InteractsWithPages
protected array $uploads All of the stored uploads for the current page. from InteractsWithPages
protected Response $response The last response returned by the application. from CrawlerTrait
protected string $currentUri The current URL being viewed. from CrawlerTrait
protected array $serverVariables Additional server variables for the request. from CrawlerTrait
protected array $beforeApplicationDestroyedCallbacks The callbacks that should be run before the application is destroyed.

Methods

void refreshApplication()

Refresh the application instance.

from ApplicationTrait
object instance(string $abstract, object $instance)

Register an instance of an object in the container.

from ApplicationTrait
$this expectsEvents(array|mixed $events)

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

from ApplicationTrait
$this withoutEvents()

Mock the event dispatcher so all events are silenced.

from ApplicationTrait
$this expectsJobs(array|mixed $jobs)

Specify a list of jobs that should be dispatched for the given operation.

from ApplicationTrait
$this withSession(array $data)

Set the session to the given array.

from ApplicationTrait
void session(array $data)

Set the session to the given array.

from ApplicationTrait
void startSession()

Start the session for the application.

from ApplicationTrait
void flushSession()

Flush all of the current session data.

from ApplicationTrait
$this withoutMiddleware()

Disable middleware for the test.

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

Set the currently logged in user for the application.

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

Set the currently logged in user for the application.

from ApplicationTrait
$this seeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition exists in the database.

from ApplicationTrait
$this missingFromDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

from ApplicationTrait
$this dontSeeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

from ApplicationTrait
$this notSeeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

from ApplicationTrait
void seed(string $class = 'DatabaseSeeder')

Seed a given database connection.

from ApplicationTrait
int artisan(string $command, array $parameters = [])

Call artisan command and return code.

from ApplicationTrait
void assertResponseOk()

Assert that the client response has an OK status code.

from AssertionsTrait
void assertResponseStatus(int $code)

Assert that the client response has a given code.

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

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

from AssertionsTrait
void assertViewHasAll(array $bindings)

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

from AssertionsTrait
void assertViewMissing(string $key)

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

from AssertionsTrait
void assertRedirectedTo(string $uri, array $with = [])

Assert whether the client was redirected to a given URI.

from AssertionsTrait
void assertRedirectedToRoute(string $name, array $parameters = [], array $with = [])

Assert whether the client was redirected to a given route.

from AssertionsTrait
void assertRedirectedToAction(string $name, array $parameters = [], array $with = [])

Assert whether the client was redirected to a given action.

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

Assert that the session has a given value.

from AssertionsTrait
void assertSessionHasAll(array $bindings)

Assert that the session has a given list of values.

from AssertionsTrait
void assertSessionHasErrors(string|array $bindings = [], mixed $format = null)

Assert that the session has errors bound.

from AssertionsTrait
void assertHasOldInput()

Assert that the session has old input.

from AssertionsTrait
$this visit(string $uri)

Visit the given URI with a GET request.

from InteractsWithPages
$this makeRequest(string $method, string $uri, array $parameters = [], array $cookies = [], array $files = [])

Make a request to the application and create a Crawler instance.

from InteractsWithPages
$this makeRequestUsingForm(Form $form, array $uploads = [])

Make a request to the application using the given form.

from InteractsWithPages
array extractParametersFromForm(Form $form)

Extract the parameters from the given form.

from InteractsWithPages
$this followRedirects()

Follow redirects from the last response.

from InteractsWithPages
$this clearInputs()

Clear the inputs for the current page.

from InteractsWithPages
$this seePageIs(string $uri)

Assert that the current page matches a given URI.

from InteractsWithPages
void assertPageLoaded(string $uri, string|null $message = null)

Assert that a given page successfully loaded.

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

Assert that a given string is seen on the page.

from InteractsWithPages
$this dontSee(string $text)

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

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

Assert that a given string is seen inside an element.

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

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

from InteractsWithPages
bool hasInElement(string $element, string $text)

Check if the page contains text within the given element.

from InteractsWithPages
$this seeLink(string $text, string|null $url = null)

Assert that a given link is seen on the page.

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

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

from InteractsWithPages
bool hasLink(string $text, string|null $url = null)

Check if the page has a link with the given $text and optional $url.

from InteractsWithPages
string addRootToRelativeUrl(string $url)

Add a root if the URL is relative (helper method of the hasLink function).

from InteractsWithPages
$this seeInField(string $selector, string $expected)

Assert that an input field contains the given value.

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

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

from InteractsWithPages
$this seeIsChecked(string $selector)

Assert that the given checkbox is selected.

from InteractsWithPages
$this dontSeeIsChecked(string $selector)

Assert that the given checkbox is not selected.

from InteractsWithPages
$this seeIsSelected(string $selector, string $expected)

Assert that the expected value is selected.

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

Assert that the given value is not selected.

from InteractsWithPages
string getInputOrTextAreaValue(string $selector)

Get the value of an input or textarea.

from InteractsWithPages
string|null getSelectedValue(string $selector)

Get the selected value of a select field or radio group.

from InteractsWithPages
string|null getSelectedValueFromSelect(Crawler $field)

Get the selected value from a select field.

from InteractsWithPages
string|null getCheckedValueFromRadioGroup(Crawler $radioGroup)

Get the checked value from a radio group.

from InteractsWithPages
bool isChecked(string $selector)

Return true if the given checkbox is checked, false otherwise.

from InteractsWithPages
$this click(string $name)

Click a link with the given body, name, or ID attribute.

from InteractsWithPages
$this type(string $text, string $element)

Fill an input field with the given text.

from InteractsWithPages
$this check(string $element)

Check a checkbox on the page.

from InteractsWithPages
$this uncheck(string $element)

Uncheck a checkbox on the page.

from InteractsWithPages
$this select(string $option, string $element)

Select an option from a drop-down.

from InteractsWithPages
$this attach(string $absolutePath, string $element)

Attach a file to a form field on the page.

from InteractsWithPages
$this press(string $buttonText)

Submit a form using the button with the given text value.

from InteractsWithPages
$this submitForm(string $buttonText, array $inputs = [], array $uploads = [])

Submit a form on the page with the given input.

from InteractsWithPages
Form fillForm(string $buttonText, array $inputs = [])

Fill the form with the given data.

from InteractsWithPages
Form getForm(string|null $buttonText = null)

Get the form from the page with the given submit button text.

from InteractsWithPages
$this storeInput(string $element, string $text)

Store a form input in the local array.

from InteractsWithPages
void assertFilterProducesResults(string $filter)

Assert that a filtered Crawler returns nodes.

from InteractsWithPages
Crawler filterByNameOrId(string $name, array|string $elements = '*')

Filter elements according to the given name or ID attribute.

from InteractsWithPages
array convertUploadsForTesting(Form $form, array $uploads)

Convert the given uploads to UploadedFile instances.

from InteractsWithPages
UploadedFile getUploadedFileForTesting(array $file, array $uploads, string $name)

Create an UploadedFile instance for testing.

from InteractsWithPages
$this json(string $method, string $uri, array $data = [], array $headers = [])

Visit the given URI with a JSON request.

from CrawlerTrait
$this get(string $uri, array $headers = [])

Visit the given URI with a GET request.

from CrawlerTrait
$this post(string $uri, array $data = [], array $headers = [])

Visit the given URI with a POST request.

from CrawlerTrait
$this put(string $uri, array $data = [], array $headers = [])

Visit the given URI with a PUT request.

from CrawlerTrait
$this patch(string $uri, array $data = [], array $headers = [])

Visit the given URI with a PATCH request.

from CrawlerTrait
$this delete(string $uri, array $data = [], array $headers = [])

Visit the given URI with a DELETE request.

from CrawlerTrait
$this handle(Request $request)

Send the given request through the application.

from CrawlerTrait
$this shouldReturnJson(array $data = null)

Assert that the response contains JSON.

from CrawlerTrait
$this|null receiveJson(array|null $data = null)

Assert that the response contains JSON.

from CrawlerTrait
$this seeJsonEquals(array $data)

Assert that the response contains an exact JSON array.

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

Assert that the response contains JSON.

from CrawlerTrait
$this dontSeeJson(array $data = null)

Assert that the response doesn't contain JSON.

from CrawlerTrait
$this seeJsonContains(array $data, bool $negate = false)

Assert that the response contains the given JSON.

from CrawlerTrait
string formatToExpectedJson(string $key, mixed $value)

Format the given key and value into a JSON string for expectation checks.

from CrawlerTrait
$this seeStatusCode(int $status)

Asserts that the status code of the response matches the given code.

from CrawlerTrait
$this seeHeader(string $headerName, mixed $value = null)

Asserts that the response contains the given header and equals the optional value.

from CrawlerTrait
$this seeCookie(string $cookieName, mixed $value = null)

Asserts that the response contains the given cookie and equals the optional value.

from CrawlerTrait
$this withServerVariables(array $server)

Define a set of server variables to be sent with the requests.

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

Call the given URI and return the Response.

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

Call the given HTTPS URI and return the Response.

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

Call a controller action and return the Response.

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

Call a named route and return the Response.

from CrawlerTrait
string prepareUrlForRequest(string $uri)

Turn the given URI into a fully qualified URL.

from CrawlerTrait
array transformHeadersToServerVars(array $headers)

Transform headers array to array of $SERVER vars with HTTP* format.

from CrawlerTrait
void dump()

Dump the content from the last response.

from CrawlerTrait
HttpKernelInterface createApplication()

Creates the application.

void setUp()

Setup the test environment.

void tearDown()

Clean up the testing environment before the next test.

void beforeApplicationDestroyed(callable $callback)

Register a callback to be run before the application is destroyed.

Details

protected void refreshApplication()

Refresh the application instance.

Return Value

void

protected object instance(string $abstract, object $instance)

Register an instance of an object in the container.

Parameters

string $abstract
object $instance

Return Value

object

$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

protected $this withoutEvents()

Mock the event dispatcher so all events are silenced.

Return Value

$this

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.

Parameters

array|mixed $jobs

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

protected void startSession()

Start the session for the application.

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

protected $this seeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition exists in the database.

Parameters

string $table
array $data
string $connection

Return Value

$this

protected $this missingFromDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

Parameters

string $table
array $data
string $connection

Return Value

$this

protected $this dontSeeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

Parameters

string $table
array $data
string $connection

Return Value

$this

protected $this notSeeInDatabase(string $table, array $data, string $connection = null)

Assert that a given where condition does not exist in the database.

Parameters

string $table
array $data
string $connection

Return Value

$this

void seed(string $class = 'DatabaseSeeder')

Seed a given database connection.

Parameters

string $class

Return Value

void

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

Call artisan command and return code.

Parameters

string $command
array $parameters

Return Value

int

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 = [])

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 $with = [])

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 $with = [])

Assert whether the client was redirected to a given action.

Parameters

string $name
array $parameters
array $with

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 assertSessionHasErrors(string|array $bindings = [], 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 visit(string $uri)

Visit the given URI with a GET request.

Parameters

string $uri

Return Value

$this

protected $this makeRequest(string $method, string $uri, array $parameters = [], array $cookies = [], array $files = [])

Make a request to the application and create a Crawler instance.

Parameters

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

Return Value

$this

protected $this makeRequestUsingForm(Form $form, array $uploads = [])

Make a request to the application using the given form.

Parameters

Form $form
array $uploads

Return Value

$this

protected array extractParametersFromForm(Form $form)

Extract the parameters from the given form.

Parameters

Form $form

Return Value

array

protected $this followRedirects()

Follow redirects from the last response.

Return Value

$this

protected $this clearInputs()

Clear the inputs for the current page.

Return Value

$this

protected $this seePageIs(string $uri)

Assert that the current page matches a given URI.

Parameters

string $uri

Return Value

$this

protected void assertPageLoaded(string $uri, string|null $message = null)

Assert that a given page successfully loaded.

Parameters

string $uri
string|null $message

Return Value

void

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

Assert that a given string is seen on the page.

Parameters

string $text
bool $negate

Return Value

$this

protected $this dontSee(string $text)

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

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

protected bool hasInElement(string $element, string $text)

Check if the page contains text within the given element.

Parameters

string $element
string $text

Return Value

bool

Assert that a given link is seen on the page.

Parameters

string $text
string|null $url

Return Value

$this

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

Parameters

string $text
string|null $url

Return Value

$this

Check if the page has a link with the given $text and optional $url.

Parameters

string $text
string|null $url

Return Value

bool

protected string addRootToRelativeUrl(string $url)

Add a root if the URL is relative (helper method of the hasLink function).

Parameters

string $url

Return Value

string

$this seeInField(string $selector, string $expected)

Assert that an input field contains the given value.

Parameters

string $selector
string $expected

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 seeIsChecked(string $selector)

Assert that the given checkbox is selected.

Parameters

string $selector

Return Value

$this

$this dontSeeIsChecked(string $selector)

Assert that the given checkbox is not selected.

Parameters

string $selector

Return Value

$this

$this seeIsSelected(string $selector, string $expected)

Assert that the expected value is selected.

Parameters

string $selector
string $expected

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

protected string getInputOrTextAreaValue(string $selector)

Get the value of an input or textarea.

Parameters

string $selector

Return Value

string

Exceptions

Exception

protected string|null getSelectedValue(string $selector)

Get the selected value of a select field or radio group.

Parameters

string $selector

Return Value

string|null

Exceptions

Exception

protected string|null getSelectedValueFromSelect(Crawler $field)

Get the selected value from a select field.

Parameters

Crawler $field

Return Value

string|null

Exceptions

Exception

protected string|null getCheckedValueFromRadioGroup(Crawler $radioGroup)

Get the checked value from a radio group.

Parameters

Crawler $radioGroup

Return Value

string|null

Exceptions

Exception

protected bool isChecked(string $selector)

Return true if the given checkbox is checked, false otherwise.

Parameters

string $selector

Return Value

bool

Exceptions

Exception

protected $this click(string $name)

Click a link with the given body, name, or ID attribute.

Parameters

string $name

Return Value

$this

protected $this type(string $text, string $element)

Fill an input field with the given text.

Parameters

string $text
string $element

Return Value

$this

protected $this check(string $element)

Check a checkbox on the page.

Parameters

string $element

Return Value

$this

protected $this uncheck(string $element)

Uncheck a checkbox on the page.

Parameters

string $element

Return Value

$this

protected $this select(string $option, string $element)

Select an option from a drop-down.

Parameters

string $option
string $element

Return Value

$this

protected $this attach(string $absolutePath, string $element)

Attach a file to a form field on the page.

Parameters

string $absolutePath
string $element

Return Value

$this

protected $this press(string $buttonText)

Submit a form using the button with the given text value.

Parameters

string $buttonText

Return Value

$this

protected $this submitForm(string $buttonText, array $inputs = [], array $uploads = [])

Submit a form on the page with the given input.

Parameters

string $buttonText
array $inputs
array $uploads

Return Value

$this

protected Form fillForm(string $buttonText, array $inputs = [])

Fill the form with the given data.

Parameters

string $buttonText
array $inputs

Return Value

Form

protected Form getForm(string|null $buttonText = null)

Get the form from the page with the given submit button text.

Parameters

string|null $buttonText

Return Value

Form

protected $this storeInput(string $element, string $text)

Store a form input in the local array.

Parameters

string $element
string $text

Return Value

$this

protected void assertFilterProducesResults(string $filter)

Assert that a filtered Crawler returns nodes.

Parameters

string $filter

Return Value

void

protected Crawler filterByNameOrId(string $name, array|string $elements = '*')

Filter elements according to the given name or ID attribute.

Parameters

string $name
array|string $elements

Return Value

Crawler

protected array convertUploadsForTesting(Form $form, array $uploads)

Convert the given uploads to UploadedFile instances.

Parameters

Form $form
array $uploads

Return Value

array

protected UploadedFile getUploadedFileForTesting(array $file, array $uploads, string $name)

Create an UploadedFile instance for testing.

Parameters

array $file
array $uploads
string $name

Return Value

UploadedFile

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

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 = [])

Visit the given URI with a GET request.

Parameters

string $uri
array $headers

Return Value

$this

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

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 $headers = [])

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 $headers = [])

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 $headers = [])

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

protected $this shouldReturnJson(array $data = null)

Assert that the response contains JSON.

Parameters

array $data

Return Value

$this

protected $this|null receiveJson(array|null $data = null)

Assert that the response contains JSON.

Parameters

array|null $data

Return Value

$this|null

$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

protected $this seeJsonContains(array $data, bool $negate = false)

Assert that the response contains the given JSON.

Parameters

array $data
bool $negate

Return Value

$this

protected string formatToExpectedJson(string $key, mixed $value)

Format the given key and value into a JSON string for expectation checks.

Parameters

string $key
mixed $value

Return Value

string

protected $this seeStatusCode(int $status)

Asserts that the status code of the response matches the given code.

Parameters

int $status

Return Value

$this

protected $this seeHeader(string $headerName, mixed $value = null)

Asserts that the response contains the given header and equals the optional value.

Parameters

string $headerName
mixed $value

Return Value

$this

protected $this seeCookie(string $cookieName, mixed $value = null)

Asserts that the response contains the given cookie and equals the optional value.

Parameters

string $cookieName
mixed $value

Return Value

$this

protected $this withServerVariables(array $server)

Define a set of server variables to be sent with the requests.

Parameters

array $server

Return Value

$this

Response call(string $method, string $uri, array $parameters = [], array $cookies = [], array $files = [], array $server = [], 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 $cookies = [], array $files = [], array $server = [], 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 $parameters = [], array $cookies = [], array $files = [], array $server = [], 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 $parameters = [], array $cookies = [], array $files = [], array $server = [], 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

protected string prepareUrlForRequest(string $uri)

Turn the given URI into a fully qualified URL.

Parameters

string $uri

Return Value

string

protected array transformHeadersToServerVars(array $headers)

Transform headers array to array of $SERVER vars with HTTP* format.

Parameters

array $headers

Return Value

array

void dump()

Dump the content from the last response.

Return Value

void

abstract HttpKernelInterface createApplication()

Creates the application.

Needs to be implemented by subclasses.

Return Value

HttpKernelInterface

void setUp()

Setup the test environment.

Return Value

void

void tearDown()

Clean up the testing environment before the next test.

Return Value

void

protected void beforeApplicationDestroyed(callable $callback)

Register a callback to be run before the application is destroyed.

Parameters

callable $callback

Return Value

void

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