Test/PHPUnit/ControllerTestCase.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Test
- Version
- $Id$
\Zend_Test_PHPUnit_ControllerTestCase
- Parent(s)
- \PHPUnit_Framework_TestCase
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
Properties
Methods


__get(mixed $name) : void
Overloading for common properties
Name | Type | Description |
---|---|---|
$name | mixed |


__set(string $name, mixed $value) : void
Overloading: prevent overloading to special properties
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |


assertAction(string $action, string $message = '') : void
Assert that the last handled request used the given action
Name | Type | Description |
---|---|---|
$action | string | |
$message | string |


assertController(string $controller, string $message = '') : void
Assert that the last handled request used the given controller
Name | Type | Description |
---|---|---|
$controller | string | |
$message | string |


assertHeader(string $header, string $message = '') : void
Assert response header exists
Name | Type | Description |
---|---|---|
$header | string | |
$message | string |


assertHeaderContains(string $header, string $match, string $message = '') : void
Assert response header exists and contains the given string
Name | Type | Description |
---|---|---|
$header | string | |
$match | string | |
$message | string |


assertHeaderRegex(string $header, string $pattern, string $message = '') : void
Assert response header exists and matches the given pattern
Name | Type | Description |
---|---|---|
$header | string | |
$pattern | string | |
$message | string |


assertModule(string $module, string $message = '') : void
Assert that the last handled request used the given module
Name | Type | Description |
---|---|---|
$module | string | |
$message | string |


assertNotAction(string $action, string $message = '') : void
Assert that the last handled request did NOT use the given action
Name | Type | Description |
---|---|---|
$action | string | |
$message | string |


assertNotController(string $controller, string $message = '') : void
Assert that the last handled request did NOT use the given controller
Name | Type | Description |
---|---|---|
$controller | string | |
$message | string |


assertNotHeader(string $header, string $message = '') : void
Assert response header does not exist
Name | Type | Description |
---|---|---|
$header | string | |
$message | string |


assertNotHeaderContains(string $header, string $match, string $message = '') : void
Assert response header does not exist and/or does not contain the given string
Name | Type | Description |
---|---|---|
$header | string | |
$match | string | |
$message | string |


assertNotHeaderRegex(string $header, string $pattern, string $message = '') : void
Assert response header does not exist and/or does not match the given regex
Name | Type | Description |
---|---|---|
$header | string | |
$pattern | string | |
$message | string |


assertNotModule(string $module, string $message = '') : void
Assert that the last handled request did NOT use the given module
Name | Type | Description |
---|---|---|
$module | string | |
$message | string |


assertNotQuery(string $path, string $message = '') : void
Assert against DOM selection
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$message | string |


assertNotQueryContentContains(string $path, string $match, string $message = '') : void
Assert against DOM selection; node should NOT contain content
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$match | string | content that should NOT be contained in matched nodes |
$message | string |


assertNotQueryContentRegex(string $path, string $pattern, string $message = '') : void
Assert against DOM selection; node should NOT match content
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$pattern | string | pattern that should NOT be contained in matched nodes |
$message | string |


assertNotQueryCount(string $path, string $count, string $message = '') : void
Assert against DOM selection; should NOT contain exact number of nodes
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$count | string | Number of nodes that should NOT match |
$message | string |


assertNotRedirect(string $message = '') : void
Assert that response is NOT a redirect
Name | Type | Description |
---|---|---|
$message | string |


assertNotRedirectRegex(string $pattern, string $message = '') : void
Assert that redirect location does not match pattern
Name | Type | Description |
---|---|---|
$pattern | string | |
$message | string |


assertNotRedirectTo(string $url, string $message = '') : void
Assert that response does not redirect to given URL
Name | Type | Description |
---|---|---|
$url | string | |
$message | string |


assertNotResponseCode(int $code, string $message = '') : void
Assert response code
Name | Type | Description |
---|---|---|
$code | int | |
$message | string |


assertNotRoute(string $route, string $message = '') : void
Assert that the route matched is NOT as specified
Name | Type | Description |
---|---|---|
$route | string | |
$message | string |


assertNotXpath(string $path, string $message = '') : void
Assert against XPath selection
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$message | string |


assertNotXpathContentContains(string $path, string $match, string $message = '') : void
Assert against XPath selection; node should NOT contain content
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$match | string | content that should NOT be contained in matched nodes |
$message | string |


assertNotXpathContentRegex(string $path, string $pattern, string $message = '') : void
Assert against XPath selection; node should NOT match content
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$pattern | string | pattern that should NOT be contained in matched nodes |
$message | string |


assertNotXpathCount(string $path, string $count, string $message = '') : void
Assert against XPath selection; should NOT contain exact number of nodes
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$count | string | Number of nodes that should NOT match |
$message | string |


assertQuery(string $path, string $message = '') : void
Assert against DOM selection
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$message | string |


assertQueryContentContains(string $path, string $match, string $message = '') : void
Assert against DOM selection; node should contain content
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$match | string | content that should be contained in matched nodes |
$message | string |


assertQueryContentRegex(string $path, string $pattern, string $message = '') : void
Assert against DOM selection; node should match content
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$pattern | string | Pattern that should be contained in matched nodes |
$message | string |


assertQueryCount(string $path, string $count, string $message = '') : void
Assert against DOM selection; should contain exact number of nodes
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$count | string | Number of nodes that should match |
$message | string |


assertQueryCountMax(string $path, string $count, string $message = '') : void
Assert against DOM selection; should contain no more than this number of nodes
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$count | string | Maximum number of nodes that should match |
$message | string |


assertQueryCountMin(string $path, string $count, string $message = '') : void
Assert against DOM selection; should contain at least this number of nodes
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |
$count | string | Minimum number of nodes that should match |
$message | string |


assertRedirect(string $message = '') : void
Assert that response is a redirect
Name | Type | Description |
---|---|---|
$message | string |


assertRedirectRegex(string $pattern, string $message = '') : void
Assert that redirect location matches pattern
Name | Type | Description |
---|---|---|
$pattern | string | |
$message | string |


assertRedirectTo(string $url, string $message = '') : void
Assert that response redirects to given URL
Name | Type | Description |
---|---|---|
$url | string | |
$message | string |


assertResponseCode(int $code, string $message = '') : void
Assert response code
Name | Type | Description |
---|---|---|
$code | int | |
$message | string |


assertRoute(string $route, string $message = '') : void
Assert that the specified route was used
Name | Type | Description |
---|---|---|
$route | string | |
$message | string |


assertXpath(string $path, string $message = '') : void
Assert against XPath selection
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$message | string |


assertXpathContentContains(string $path, string $match, string $message = '') : void
Assert against XPath selection; node should contain content
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$match | string | content that should be contained in matched nodes |
$message | string |


assertXpathContentRegex(string $path, string $pattern, string $message = '') : void
Assert against XPath selection; node should match content
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$pattern | string | Pattern that should be contained in matched nodes |
$message | string |


assertXpathCount(string $path, string $count, string $message = '') : void
Assert against XPath selection; should contain exact number of nodes
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$count | string | Number of nodes that should match |
$message | string |


assertXpathCountMax(string $path, string $count, string $message = '') : void
Assert against XPath selection; should contain no more than this number of nodes
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$count | string | Maximum number of nodes that should match |
$message | string |


assertXpathCountMin(string $path, string $count, string $message = '') : void
Assert against XPath selection; should contain at least this number of nodes
Name | Type | Description |
---|---|---|
$path | string | XPath path |
$count | string | Minimum number of nodes that should match |
$message | string |


bootstrap() : void
Bootstrap the front controller


dispatch(string | null $url = null) : void
Dispatch the MVC
Name | Type | Description |
---|---|---|
$url | string | null |


getFrontController() : \Zend_Controller_Front
Retrieve front controller instance
Type | Description |
---|---|
\Zend_Controller_Front |


getRequest() : \Zend_Controller_Request_HttpTestCase
Retrieve test case request object
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


getResponse() : \Zend_Controller_Response_HttpTestCase
Retrieve test case response object
Type | Description |
---|---|
\Zend_Controller_Response_HttpTestCase |


registerXpathNamespaces(array $xpathNamespaces) : void
Register XPath namespaces
Name | Type | Description |
---|---|---|
$xpathNamespaces | array |


reset() : void
Reset MVC state
- Todo
- Need to update Zend_Layout to add a resetInstance() method


resetRequest() : \Zend_Test_PHPUnit_ControllerTestCase
Reset the request object
Type | Description |
---|---|
\Zend_Test_PHPUnit_ControllerTestCase |


resetResponse() : \Zend_Test_PHPUnit_ControllerTestCase
Reset the response object
Type | Description |
---|---|
\Zend_Test_PHPUnit_ControllerTestCase |


url(array $urlOptions = array(), string $name = null, bool $reset = false, bool $encode = true) : void
URL Helper
Name | Type | Description |
---|---|---|
$urlOptions | array | |
$name | string | |
$reset | bool | |
$encode | bool |