Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Test_PHPUnit_ControllerTestCase Class Reference

Public Member Functions

 __set ($name, $value)
 Overloading: prevent overloading to special properties.
 
 __get ($name)
 Overloading for common properties.
 
 bootstrap ()
 Bootstrap the front controller.
 
 dispatch ($url=null)
 Dispatch the MVC.
 
 reset ()
 Reset MVC state.
 
 resetRequest ()
 Reset the request object.
 
 resetResponse ()
 Reset the response object.
 
 assertQuery ($path, $message= '')
 Assert against DOM selection.
 
 assertNotQuery ($path, $message= '')
 Assert against DOM selection.
 
 assertQueryContentContains ($path, $match, $message= '')
 Assert against DOM selection; node should contain content.
 
 assertNotQueryContentContains ($path, $match, $message= '')
 Assert against DOM selection; node should NOT contain content.
 
 assertQueryContentRegex ($path, $pattern, $message= '')
 Assert against DOM selection; node should match content.
 
 assertNotQueryContentRegex ($path, $pattern, $message= '')
 Assert against DOM selection; node should NOT match content.
 
 assertQueryCount ($path, $count, $message= '')
 Assert against DOM selection; should contain exact number of nodes.
 
 assertNotQueryCount ($path, $count, $message= '')
 Assert against DOM selection; should NOT contain exact number of nodes.
 
 assertQueryCountMin ($path, $count, $message= '')
 Assert against DOM selection; should contain at least this number of nodes.
 
 assertQueryCountMax ($path, $count, $message= '')
 Assert against DOM selection; should contain no more than this number of nodes.
 
 registerXpathNamespaces ($xpathNamespaces)
 Register XPath namespaces.
 
 assertXpath ($path, $message= '')
 Assert against XPath selection.
 
 assertNotXpath ($path, $message= '')
 Assert against XPath selection.
 
 assertXpathContentContains ($path, $match, $message= '')
 Assert against XPath selection; node should contain content.
 
 assertNotXpathContentContains ($path, $match, $message= '')
 Assert against XPath selection; node should NOT contain content.
 
 assertXpathContentRegex ($path, $pattern, $message= '')
 Assert against XPath selection; node should match content.
 
 assertNotXpathContentRegex ($path, $pattern, $message= '')
 Assert against XPath selection; node should NOT match content.
 
 assertXpathCount ($path, $count, $message= '')
 Assert against XPath selection; should contain exact number of nodes.
 
 assertNotXpathCount ($path, $count, $message= '')
 Assert against XPath selection; should NOT contain exact number of nodes.
 
 assertXpathCountMin ($path, $count, $message= '')
 Assert against XPath selection; should contain at least this number of nodes.
 
 assertXpathCountMax ($path, $count, $message= '')
 Assert against XPath selection; should contain no more than this number of nodes.
 
 assertRedirect ($message= '')
 Assert that response is a redirect.
 
 assertNotRedirect ($message= '')
 Assert that response is NOT a redirect.
 
 assertRedirectTo ($url, $message= '')
 Assert that response redirects to given URL.
 
 assertNotRedirectTo ($url, $message= '')
 Assert that response does not redirect to given URL.
 
 assertRedirectRegex ($pattern, $message= '')
 Assert that redirect location matches pattern.
 
 assertNotRedirectRegex ($pattern, $message= '')
 Assert that redirect location does not match pattern.
 
 assertResponseCode ($code, $message= '')
 Assert response code.
 
 assertNotResponseCode ($code, $message= '')
 Assert response code.
 
 assertHeader ($header, $message= '')
 Assert response header exists.
 
 assertNotHeader ($header, $message= '')
 Assert response header does not exist.
 
 assertHeaderContains ($header, $match, $message= '')
 Assert response header exists and contains the given string.
 
 assertNotHeaderContains ($header, $match, $message= '')
 Assert response header does not exist and/or does not contain the given string.
 
 assertHeaderRegex ($header, $pattern, $message= '')
 Assert response header exists and matches the given pattern.
 
 assertNotHeaderRegex ($header, $pattern, $message= '')
 Assert response header does not exist and/or does not match the given regex.
 
 assertModule ($module, $message= '')
 Assert that the last handled request used the given module.
 
 assertNotModule ($module, $message= '')
 Assert that the last handled request did NOT use the given module.
 
 assertController ($controller, $message= '')
 Assert that the last handled request used the given controller.
 
 assertNotController ($controller, $message= '')
 Assert that the last handled request did NOT use the given controller.
 
 assertAction ($action, $message= '')
 Assert that the last handled request used the given action.
 
 assertNotAction ($action, $message= '')
 Assert that the last handled request did NOT use the given action.
 
 assertRoute ($route, $message= '')
 Assert that the specified route was used.
 
 assertNotRoute ($route, $message= '')
 Assert that the route matched is NOT as specified.
 
 getFrontController ()
 Retrieve front controller instance.
 
 getRequest ()
 Retrieve test case request object.
 
 getResponse ()
 Retrieve test case response object.
 
 getQuery ()
 Retrieve DOM query object.
 
 url ($urlOptions=array(), $name=null, $reset=false, $encode=true)
 URL Helper.
 
 urlizeOptions ($urlOptions, $actionControllerModuleOnly=true)
 

Public Attributes

 $bootstrap
 

Protected Member Functions

 setUp ()
 Set up MVC app.
 
 _resetPlaceholders ()
 Rest all view placeholders.
 
 _incrementAssertionCount ()
 Increment assertion count.
 

Protected Attributes

 $_frontController
 
 $_query
 
 $_request
 
 $_response
 
 $_xpathNamespaces = array()
 

Member Function Documentation

__get (   $name)

Overloading for common properties.

Provides overloading for request, response, and frontController objects.

Parameters
mixed$name
Returns
void
__set (   $name,
  $value 
)

Overloading: prevent overloading to special properties.

Parameters
string$name
mixed$value
Returns
void
_incrementAssertionCount ( )
protected

Increment assertion count.

Returns
void
_resetPlaceholders ( )
protected

Rest all view placeholders.

Returns
void
assertAction (   $action,
  $message = '' 
)

Assert that the last handled request used the given action.

Parameters
string$action
string$message
Returns
void
assertController (   $controller,
  $message = '' 
)

Assert that the last handled request used the given controller.

Parameters
string$controller
string$message
Returns
void
assertHeader (   $header,
  $message = '' 
)

Assert response header exists.

Parameters
string$header
string$message
Returns
void
assertHeaderContains (   $header,
  $match,
  $message = '' 
)

Assert response header exists and contains the given string.

Parameters
string$header
string$match
string$message
Returns
void
assertHeaderRegex (   $header,
  $pattern,
  $message = '' 
)

Assert response header exists and matches the given pattern.

Parameters
string$header
string$pattern
string$message
Returns
void
assertModule (   $module,
  $message = '' 
)

Assert that the last handled request used the given module.

Parameters
string$module
string$message
Returns
void
assertNotAction (   $action,
  $message = '' 
)

Assert that the last handled request did NOT use the given action.

Parameters
string$action
string$message
Returns
void
assertNotController (   $controller,
  $message = '' 
)

Assert that the last handled request did NOT use the given controller.

Parameters
string$controller
string$message
Returns
void
assertNotHeader (   $header,
  $message = '' 
)

Assert response header does not exist.

Parameters
string$header
string$message
Returns
void
assertNotHeaderContains (   $header,
  $match,
  $message = '' 
)

Assert response header does not exist and/or does not contain the given string.

Parameters
string$header
string$match
string$message
Returns
void
assertNotHeaderRegex (   $header,
  $pattern,
  $message = '' 
)

Assert response header does not exist and/or does not match the given regex.

Parameters
string$header
string$pattern
string$message
Returns
void
assertNotModule (   $module,
  $message = '' 
)

Assert that the last handled request did NOT use the given module.

Parameters
string$module
string$message
Returns
void
assertNotQuery (   $path,
  $message = '' 
)

Assert against DOM selection.

Parameters
string$pathCSS selector path
string$message
Returns
void
assertNotQueryContentContains (   $path,
  $match,
  $message = '' 
)

Assert against DOM selection; node should NOT contain content.

Parameters
string$pathCSS selector path
string$matchcontent that should NOT be contained in matched nodes
string$message
Returns
void
assertNotQueryContentRegex (   $path,
  $pattern,
  $message = '' 
)

Assert against DOM selection; node should NOT match content.

Parameters
string$pathCSS selector path
string$patternpattern that should NOT be contained in matched nodes
string$message
Returns
void
assertNotQueryCount (   $path,
  $count,
  $message = '' 
)

Assert against DOM selection; should NOT contain exact number of nodes.

Parameters
string$pathCSS selector path
string$countNumber of nodes that should NOT match
string$message
Returns
void
assertNotRedirect (   $message = '')

Assert that response is NOT a redirect.

Parameters
string$message
Returns
void
assertNotRedirectRegex (   $pattern,
  $message = '' 
)

Assert that redirect location does not match pattern.

Parameters
string$pattern
string$message
Returns
void
assertNotRedirectTo (   $url,
  $message = '' 
)

Assert that response does not redirect to given URL.

Parameters
string$url
string$message
Returns
void
assertNotResponseCode (   $code,
  $message = '' 
)

Assert response code.

Parameters
int$code
string$message
Returns
void
assertNotRoute (   $route,
  $message = '' 
)

Assert that the route matched is NOT as specified.

Parameters
string$route
string$message
Returns
void
assertNotXpath (   $path,
  $message = '' 
)

Assert against XPath selection.

Parameters
string$pathXPath path
string$message
Returns
void
assertNotXpathContentContains (   $path,
  $match,
  $message = '' 
)

Assert against XPath selection; node should NOT contain content.

Parameters
string$pathXPath path
string$matchcontent that should NOT be contained in matched nodes
string$message
Returns
void
assertNotXpathContentRegex (   $path,
  $pattern,
  $message = '' 
)

Assert against XPath selection; node should NOT match content.

Parameters
string$pathXPath path
string$patternpattern that should NOT be contained in matched nodes
string$message
Returns
void
assertNotXpathCount (   $path,
  $count,
  $message = '' 
)

Assert against XPath selection; should NOT contain exact number of nodes.

Parameters
string$pathXPath path
string$countNumber of nodes that should NOT match
string$message
Returns
void
assertQuery (   $path,
  $message = '' 
)

Assert against DOM selection.

Parameters
string$pathCSS selector path
string$message
Returns
void
assertQueryContentContains (   $path,
  $match,
  $message = '' 
)

Assert against DOM selection; node should contain content.

Parameters
string$pathCSS selector path
string$matchcontent that should be contained in matched nodes
string$message
Returns
void
assertQueryContentRegex (   $path,
  $pattern,
  $message = '' 
)

Assert against DOM selection; node should match content.

Parameters
string$pathCSS selector path
string$patternPattern that should be contained in matched nodes
string$message
Returns
void
assertQueryCount (   $path,
  $count,
  $message = '' 
)

Assert against DOM selection; should contain exact number of nodes.

Parameters
string$pathCSS selector path
string$countNumber of nodes that should match
string$message
Returns
void
assertQueryCountMax (   $path,
  $count,
  $message = '' 
)

Assert against DOM selection; should contain no more than this number of nodes.

Parameters
string$pathCSS selector path
string$countMaximum number of nodes that should match
string$message
Returns
void
assertQueryCountMin (   $path,
  $count,
  $message = '' 
)

Assert against DOM selection; should contain at least this number of nodes.

Parameters
string$pathCSS selector path
string$countMinimum number of nodes that should match
string$message
Returns
void
assertRedirect (   $message = '')

Assert that response is a redirect.

Parameters
string$message
Returns
void
assertRedirectRegex (   $pattern,
  $message = '' 
)

Assert that redirect location matches pattern.

Parameters
string$pattern
string$message
Returns
void
assertRedirectTo (   $url,
  $message = '' 
)

Assert that response redirects to given URL.

Parameters
string$url
string$message
Returns
void
assertResponseCode (   $code,
  $message = '' 
)

Assert response code.

Parameters
int$code
string$message
Returns
void
assertRoute (   $route,
  $message = '' 
)

Assert that the specified route was used.

Parameters
string$route
string$message
Returns
void
assertXpath (   $path,
  $message = '' 
)

Assert against XPath selection.

Parameters
string$pathXPath path
string$message
Returns
void
assertXpathContentContains (   $path,
  $match,
  $message = '' 
)

Assert against XPath selection; node should contain content.

Parameters
string$pathXPath path
string$matchcontent that should be contained in matched nodes
string$message
Returns
void
assertXpathContentRegex (   $path,
  $pattern,
  $message = '' 
)

Assert against XPath selection; node should match content.

Parameters
string$pathXPath path
string$patternPattern that should be contained in matched nodes
string$message
Returns
void
assertXpathCount (   $path,
  $count,
  $message = '' 
)

Assert against XPath selection; should contain exact number of nodes.

Parameters
string$pathXPath path
string$countNumber of nodes that should match
string$message
Returns
void
assertXpathCountMax (   $path,
  $count,
  $message = '' 
)

Assert against XPath selection; should contain no more than this number of nodes.

Parameters
string$pathXPath path
string$countMaximum number of nodes that should match
string$message
Returns
void
assertXpathCountMin (   $path,
  $count,
  $message = '' 
)

Assert against XPath selection; should contain at least this number of nodes.

Parameters
string$pathXPath path
string$countMinimum number of nodes that should match
string$message
Returns
void
bootstrap ( )
final

Bootstrap the front controller.

Resets the front controller, and then bootstraps it.

If $bootstrap is a callback, executes it; if it is a file, it include's it. When done, sets the test case request and response objects into the front controller.

Returns
void
dispatch (   $url = null)

Dispatch the MVC.

If a URL is provided, sets it as the request URI in the request object. Then sets test case request and response objects in front controller, disables throwing exceptions, and disables returning the response. Finally, dispatches the front controller.

Parameters
string | null$url
Returns
void
getFrontController ( )

Retrieve front controller instance.

Returns
Zend_Controller_Front
getQuery ( )

Retrieve DOM query object.

Returns
Zend_Dom_Query
getRequest ( )

Retrieve test case request object.

Returns
Zend_Controller_Request_HttpTestCase
getResponse ( )

Retrieve test case response object.

Returns
Zend_Controller_Response_HttpTestCase
registerXpathNamespaces (   $xpathNamespaces)

Register XPath namespaces.

Parameters
array$xpathNamespaces
Returns
void
reset ( )

Reset MVC state.

Creates new request/response objects, resets the front controller instance, and resets the action helper broker.

Todo:
Need to update Zend_Layout to add a resetInstance() method
Returns
void
resetRequest ( )

Reset the request object.

Useful for test cases that need to test multiple trips to the server.

Returns
Zend_Test_PHPUnit_ControllerTestCase
resetResponse ( )

Reset the response object.

Useful for test cases that need to test multiple trips to the server.

Returns
Zend_Test_PHPUnit_ControllerTestCase
setUp ( )
protected

Set up MVC app.

Calls bootstrap() by default

Returns
void
url (   $urlOptions = array(),
  $name = null,
  $reset = false,
  $encode = true 
)

URL Helper.

Parameters
array$urlOptions
string$name
bool$reset
bool$encode
urlizeOptions (   $urlOptions,
  $actionControllerModuleOnly = true 
)

Member Data Documentation

$_frontController
protected
$_query
protected
$_request
protected
$_response
protected
$_xpathNamespaces = array()
protected