API Documentation

Test/PHPUnit/ControllerTestCase.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Test
version
$Id: ControllerTestCase.php 20484 2010-01-21 18:13:31Z matthew $
Classes
Zend_Test_PHPUnit_ControllerTestCase

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Test_PHPUnit_ControllerTestCase

Extends from
PHPUnit_Framework_TestCase
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Test
subpackage
PHPUnit
uses
PHPUnit_Framework_TestCase
Properties
$bootstrap
$_frontController
$_query
$_request
$_response
Methods
__set
__get
setUp
bootstrap
dispatch
reset
_resetPlaceholders
resetRequest
resetResponse
assertQuery
assertNotQuery
assertQueryContentContains
assertNotQueryContentContains
assertQueryContentRegex
assertNotQueryContentRegex
assertQueryCount
assertNotQueryCount
assertQueryCountMin
assertQueryCountMax
assertXpath
assertNotXpath
assertXpathContentContains
assertNotXpathContentContains
assertXpathContentRegex
assertNotXpathContentRegex
assertXpathCount
assertNotXpathCount
assertXpathCountMin
assertXpathCountMax
assertRedirect
assertNotRedirect
assertRedirectTo
assertNotRedirectTo
assertRedirectRegex
assertNotRedirectRegex
assertResponseCode
assertNotResponseCode
assertHeader
assertNotHeader
assertHeaderContains
assertNotHeaderContains
assertHeaderRegex
assertNotHeaderRegex
assertModule
assertNotModule
assertController
assertNotController
assertAction
assertNotAction
assertRoute
assertNotRoute
getFrontController
getRequest
getResponse
getQuery
_incrementAssertionCount

Description

Functional testing scaffold for MVC applications

Properties

$_frontController

Zend_Controller_Front $_frontController = ''

Details

$_frontController
Zend_Controller_Front
visibility
protected
default
final
false
static
false

$_query

Zend_Dom_Query $_query = ''

Details

$_query
Zend_Dom_Query
visibility
protected
default
final
false
static
false

$_request

Zend_Controller_Request_Abstract $_request = ''

Details

$_request
Zend_Controller_Request_Abstract
visibility
protected
default
final
false
static
false

$_response

Zend_Controller_Response_Abstract $_response = ''

Details

$_response
Zend_Controller_Response_Abstract
visibility
protected
default
final
false
static
false

$bootstrap

mixed $bootstrap = ''

Details

$bootstrap
mixed
Bootstrap file path or callback
visibility
public
default
final
false
static
false

Methods

__get

__get( mixed $name ) : void

Overloading for common properties

Provides overloading for request, response, and frontController objects.

Arguments
$name
mixed
Details
visibility
public
final
false
static
false

__set

__set( string $name, mixed $value ) : void

Overloading: prevent overloading to special properties

Arguments
$name
string
$value
mixed
Details
visibility
public
final
false
static
false

_incrementAssertionCount

_incrementAssertionCount( ) : void

Increment assertion count

Details
visibility
protected
final
false
static
false

_resetPlaceholders

_resetPlaceholders( ) : void

Rest all view placeholders

Details
visibility
protected
final
false
static
false

assertAction

assertAction( string $action, string $message ) : void

Assert that the last handled request used the given action

Arguments
$action
string
$message
string
Details
visibility
public
final
false
static
false

assertController

assertController( string $controller, string $message ) : void

Assert that the last handled request used the given controller

Arguments
$controller
string
$message
string
Details
visibility
public
final
false
static
false

assertHeader

assertHeader( string $header, string $message ) : void

Assert response header exists

Arguments
$header
string
$message
string
Details
visibility
public
final
false
static
false

assertHeaderContains

assertHeaderContains( string $header, string $match, string $message ) : void

Assert response header exists and contains the given string

Arguments
$header
string
$match
string
$message
string
Details
visibility
public
final
false
static
false

assertHeaderRegex

assertHeaderRegex( string $header, string $pattern, string $message ) : void

Assert response header exists and matches the given pattern

Arguments
$header
string
$pattern
string
$message
string
Details
visibility
public
final
false
static
false

assertModule

assertModule( string $module, string $message ) : void

Assert that the last handled request used the given module

Arguments
$module
string
$message
string
Details
visibility
public
final
false
static
false

assertNotAction

assertNotAction( string $action, string $message ) : void

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

Arguments
$action
string
$message
string
Details
visibility
public
final
false
static
false

assertNotController

assertNotController( string $controller, string $message ) : void

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

Arguments
$controller
string
$message
string
Details
visibility
public
final
false
static
false

assertNotHeader

assertNotHeader( string $header, string $message ) : void

Assert response header does not exist

Arguments
$header
string
$message
string
Details
visibility
public
final
false
static
false

assertNotHeaderContains

assertNotHeaderContains( string $header, string $match, string $message ) : void

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

Arguments
$header
string
$match
string
$message
string
Details
visibility
public
final
false
static
false

assertNotHeaderRegex

assertNotHeaderRegex( string $header, string $pattern, string $message ) : void

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

Arguments
$header
string
$pattern
string
$message
string
Details
visibility
public
final
false
static
false

assertNotModule

assertNotModule( string $module, string $message ) : void

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

Arguments
$module
string
$message
string
Details
visibility
public
final
false
static
false

assertNotQuery

assertNotQuery( string $path, string $message ) : void

Assert against DOM selection

Arguments
$path
string
CSS selector path
$message
string
Details
visibility
public
final
false
static
false

assertNotQueryContentContains

assertNotQueryContentContains( string $path, string $match, string $message ) : void

Assert against DOM selection; node should NOT contain content

Arguments
$path
string
CSS selector path
$match
string
content that should NOT be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertNotQueryContentRegex

assertNotQueryContentRegex( string $path, string $pattern, string $message ) : void

Assert against DOM selection; node should NOT match content

Arguments
$path
string
CSS selector path
$pattern
string
pattern that should NOT be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertNotQueryCount

assertNotQueryCount( string $path, string $count, string $message ) : void

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

Arguments
$path
string
CSS selector path
$count
string
Number of nodes that should NOT match
$message
string
Details
visibility
public
final
false
static
false

assertNotRedirect

assertNotRedirect( string $message ) : void

Assert that response is NOT a redirect

Arguments
$message
string
Details
visibility
public
final
false
static
false

assertNotRedirectRegex

assertNotRedirectRegex( string $pattern, string $message ) : void

Assert that redirect location does not match pattern

Arguments
$pattern
string
$message
string
Details
visibility
public
final
false
static
false

assertNotRedirectTo

assertNotRedirectTo( string $url, string $message ) : void

Assert that response does not redirect to given URL

Arguments
$url
string
$message
string
Details
visibility
public
final
false
static
false

assertNotResponseCode

assertNotResponseCode( int $code, string $message ) : void

Assert response code

Arguments
$code
int
$message
string
Details
visibility
public
final
false
static
false

assertNotRoute

assertNotRoute( string $route, string $message ) : void

Assert that the route matched is NOT as specified

Arguments
$route
string
$message
string
Details
visibility
public
final
false
static
false

assertNotXpath

assertNotXpath( string $path, string $message ) : void

Assert against XPath selection

Arguments
$path
string
XPath path
$message
string
Details
visibility
public
final
false
static
false

assertNotXpathContentContains

assertNotXpathContentContains( string $path, string $match, string $message ) : void

Assert against XPath selection; node should NOT contain content

Arguments
$path
string
XPath path
$match
string
content that should NOT be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertNotXpathContentRegex

assertNotXpathContentRegex( string $path, string $pattern, string $message ) : void

Assert against XPath selection; node should NOT match content

Arguments
$path
string
XPath path
$pattern
string
pattern that should NOT be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertNotXpathCount

assertNotXpathCount( string $path, string $count, string $message ) : void

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

Arguments
$path
string
XPath path
$count
string
Number of nodes that should NOT match
$message
string
Details
visibility
public
final
false
static
false

assertQuery

assertQuery( string $path, string $message ) : void

Assert against DOM selection

Arguments
$path
string
CSS selector path
$message
string
Details
visibility
public
final
false
static
false

assertQueryContentContains

assertQueryContentContains( string $path, string $match, string $message ) : void

Assert against DOM selection; node should contain content

Arguments
$path
string
CSS selector path
$match
string
content that should be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertQueryContentRegex

assertQueryContentRegex( string $path, string $pattern, string $message ) : void

Assert against DOM selection; node should match content

Arguments
$path
string
CSS selector path
$pattern
string
Pattern that should be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertQueryCount

assertQueryCount( string $path, string $count, string $message ) : void

Assert against DOM selection; should contain exact number of nodes

Arguments
$path
string
CSS selector path
$count
string
Number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

assertQueryCountMax

assertQueryCountMax( string $path, string $count, string $message ) : void

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

Arguments
$path
string
CSS selector path
$count
string
Maximum number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

assertQueryCountMin

assertQueryCountMin( string $path, string $count, string $message ) : void

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

Arguments
$path
string
CSS selector path
$count
string
Minimum number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

assertRedirect

assertRedirect( string $message ) : void

Assert that response is a redirect

Arguments
$message
string
Details
visibility
public
final
false
static
false

assertRedirectRegex

assertRedirectRegex( string $pattern, string $message ) : void

Assert that redirect location matches pattern

Arguments
$pattern
string
$message
string
Details
visibility
public
final
false
static
false

assertRedirectTo

assertRedirectTo( string $url, string $message ) : void

Assert that response redirects to given URL

Arguments
$url
string
$message
string
Details
visibility
public
final
false
static
false

assertResponseCode

assertResponseCode( int $code, string $message ) : void

Assert response code

Arguments
$code
int
$message
string
Details
visibility
public
final
false
static
false

assertRoute

assertRoute( string $route, string $message ) : void

Assert that the specified route was used

Arguments
$route
string
$message
string
Details
visibility
public
final
false
static
false

assertXpath

assertXpath( string $path, string $message ) : void

Assert against XPath selection

Arguments
$path
string
XPath path
$message
string
Details
visibility
public
final
false
static
false

assertXpathContentContains

assertXpathContentContains( string $path, string $match, string $message ) : void

Assert against XPath selection; node should contain content

Arguments
$path
string
XPath path
$match
string
content that should be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertXpathContentRegex

assertXpathContentRegex( string $path, string $pattern, string $message ) : void

Assert against XPath selection; node should match content

Arguments
$path
string
XPath path
$pattern
string
Pattern that should be contained in matched nodes
$message
string
Details
visibility
public
final
false
static
false

assertXpathCount

assertXpathCount( string $path, string $count, string $message ) : void

Assert against XPath selection; should contain exact number of nodes

Arguments
$path
string
XPath path
$count
string
Number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

assertXpathCountMax

assertXpathCountMax( string $path, string $count, string $message ) : void

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

Arguments
$path
string
XPath path
$count
string
Maximum number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

assertXpathCountMin

assertXpathCountMin( string $path, string $count, string $message ) : void

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

Arguments
$path
string
XPath path
$count
string
Minimum number of nodes that should match
$message
string
Details
visibility
public
final
false
static
false

bootstrap

bootstrap( ) : void

Bootstrap the front controller

Resets the front controller, and then bootstraps it.

If {@link $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.

Details
visibility
public
final
true
static
false

dispatch

dispatch( string|null $url = null ) : void

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.

Arguments
$url
stringnull
Details
visibility
public
final
false
static
false

getFrontController

getFrontController( ) : Zend_Controller_Front

Retrieve front controller instance

Details
visibility
public
final
false
static
false

getQuery

getQuery( ) : Zend_Dom_Query

Retrieve DOM query object

Details
visibility
public
final
false
static
false

getRequest

getRequest( ) : Zend_Controller_Request_Abstract

Retrieve test case request object

Details
visibility
public
final
false
static
false

getResponse

getResponse( ) : Zend_Controller_Response_Abstract

Retrieve test case response object

Details
visibility
public
final
false
static
false

reset

reset( ) : void

Reset MVC state

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

Details
visibility
public
final
false
static
false
todo
Need to update Zend_Layout to add a resetInstance() method

resetRequest

resetRequest( ) : Zend_Test_PHPUnit_ControllerTestCase

Reset the request object

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

Details
visibility
public
final
false
static
false

resetResponse

resetResponse( ) : Zend_Test_PHPUnit_ControllerTestCase

Reset the response object

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

Details
visibility
public
final
false
static
false

setUp

setUp( ) : void

Set up MVC app

Calls {@link bootstrap()} by default

Details
visibility
protected
final
false
static
false
Documentation was generated by DocBlox.