PHP Class Zizaco\TestCases\ControllerTestCase

Inheritance: extends TestCase
Show file Open project: zizaco/testcases-laravel

Protected Properties

Property Type Description
$crawler Symfony\Component\DomCrawler\Crawler The Synfony's DomCrawler of the last request
$lastException Symfony\Component\HttpKernel\Exception\HttpException Will the last HttpException caught
$requestInput array Will contain the parameters of the next request

Public Methods

Method Description
assertBodyHasHtml ( $needle )
assertBodyHasNotText ( $needle )
assertBodyHasText ( $needle )
assertRedirection ( $location = null ) : void Asserts if page was redirected correctly
assertRequestOk ( ) : void Asserts if the request was Ok (200)
assertSessionHas ( string $name, mixed $value = null ) : void. Asserts if the session variable is correct
assertStatusCode ( $code ) : void Asserts if the status code is correct
getBodyHtml ( )
getBodyText ( )
requestAction ( string $method, string $action, $params = [] ) : ControllerTestCase Request an URL by the action name
requestUrl ( string $method, string $url, $params = [] ) : ControllerTestCase Request an URL
setUp ( ) Set session and enable Laravel filters
withInput ( array $params ) : mixed Set the post parameters and return this for chainable method call

Method Details

assertBodyHasHtml() public method

public assertBodyHasHtml ( $needle )

assertBodyHasNotText() public method

public assertBodyHasNotText ( $needle )

assertBodyHasText() public method

public assertBodyHasText ( $needle )

assertRedirection() public method

Asserts if page was redirected correctly
public assertRedirection ( $location = null ) : void
$location Location where it should be redirected
return void

assertRequestOk() public method

Asserts if the request was Ok (200)
public assertRequestOk ( ) : void
return void

assertSessionHas() public method

Asserts if the session variable is correct
public assertSessionHas ( string $name, mixed $value = null ) : void.
$name string Session variable name.
$value mixed Session variable value.
return void.

assertStatusCode() public method

Asserts if the status code is correct
public assertStatusCode ( $code ) : void
$code Correct status code
return void

getBodyHtml() public method

public getBodyHtml ( )

getBodyText() public method

public getBodyText ( )

requestAction() public method

Request an URL by the action name
public requestAction ( string $method, string $action, $params = [] ) : ControllerTestCase
$method string
$action string
return ControllerTestCase this for method chaining.

requestUrl() public method

Request an URL
public requestUrl ( string $method, string $url, $params = [] ) : ControllerTestCase
$method string
$url string
return ControllerTestCase this for method chaining.

setUp() public method

Set session and enable Laravel filters
public setUp ( )

withInput() public method

Set the post parameters and return this for chainable method call
public withInput ( array $params ) : mixed
$params array Post paratemers array.
return mixed this.

Property Details

$crawler protected property

The Synfony's DomCrawler of the last request
protected Symfony\Component\DomCrawler\Crawler $crawler
return Symfony\Component\DomCrawler\Crawler

$lastException protected property

Will the last HttpException caught
protected HttpException,Symfony\Component\HttpKernel\Exception $lastException
return Symfony\Component\HttpKernel\Exception\HttpException

$requestInput protected property

Will contain the parameters of the next request
protected array $requestInput
return array