CrawlerTrait (Foundation\Testing)

CrawlerTrait

trait CrawlerTrait (View source)

Traits

InteractsWithPages

Methods

$this visit( string $uri)

Visit the given URI with a GET request.

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

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.

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.

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.

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 dump()

Dump the content from the last response.

Details

$this visit( string $uri)

Visit the given URI with a GET request.

Parameters

string $uri

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

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)

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

$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

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 dump()

Dump the content from the last response.

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/CrawlerTrait.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部