\Dewdrop\Test\AdminAdminDbTestCase

All admin test case classes implement this interface to ensure that all admin test cases offer the same functionality. We can't handle this with inheritance because we must inherit different classes for stock test cases and DB test cases. Once we can rely on PHP 5.4.x, traits will help make this simpler.

Summary

Methods
Properties
Constants
getConnection()
getSetUpOperation()
assertMatchesDomQuery()
assertNotMatchesDomQuery()
queryDom()
initHelper()
setMockResponseHelper()
dispatchPage()
getPage()
getResponseHelper()
getComponent()
getDb()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getConnection()

getConnection() : \PDO

Create the PDO connection for PHPUnit using constants defined in wp-config.php.

Returns

\PDO

getSetUpOperation()

getSetUpOperation() : \PHPUnit_Extensions_Database_Operation_Composite

Use our own truncate operation so that we can work with InnoDB foreign keys constraints.

Returns

\PHPUnit_Extensions_Database_Operation_Composite

assertMatchesDomQuery()

assertMatchesDomQuery(string  $selector, string  $html) : void

Assert that the supplied CSS selector matches the supplied HTML.

Parameters

string $selector

A CSS selected.

string $html

The HTML you are selecting against.

assertNotMatchesDomQuery()

assertNotMatchesDomQuery(string  $selector, string  $html) : void

Assert that the supplied CSS selector does not have matches in the supplied HTML.

Parameters

string $selector

A CSS selected.

string $html

The HTML you are selecting against.

queryDom()

queryDom(string  $selector, string  $html) : \Zend\Dom\NodeList

Use the supplied CSS selector to query the HTML. Returns the results as a \Zend\Dom\NodeList, which can be iterated over to inspect the resulting DOMElement objects as needed.

Parameters

string $selector
string $html

Returns

\Zend\Dom\NodeList

initHelper()

initHelper(string  $componentFolder, string  $componentNamespace) : \Dewdrop\Test\Admin\Dewdrop\Test\Admin\AdminInterface

Initialize the admin helper for this test case. This should be called in your test case's setUp() method so that you can dispatch pages from your component for testing.

Parameters

string $componentFolder
string $componentNamespace

Returns

\Dewdrop\Test\Admin\Dewdrop\Test\Admin\AdminInterface

setMockResponseHelper()

setMockResponseHelper(boolean  $mockResponseHelper) : \Dewdrop\Test\Admin\AdminInterface

Whether to mock the execution of the queued response helper actions.

Parameters

boolean $mockResponseHelper

Returns

\Dewdrop\Test\Admin\AdminInterface

dispatchPage()

dispatchPage(string  $name, array  $post = array(), array  $query = array()) : \Dewdrop\Admin\Response

Dispatch the named page with the POST and GET values supplied to the request object. The response object will be returned so that you can examine the output, etc.

Parameters

string $name
array $post
array $query

Returns

\Dewdrop\Admin\Response

getPage()

getPage(string  $name, array  $post = array(), array  $query = array()) : \Dewdrop\Admin\Page\PageAbstract

Get an object for the named page. Allows you to play with the page outside the stock dispatch loop implemented in ComponentAbstract.

Parameters

string $name
array $post
array $query

Returns

\Dewdrop\Admin\Page\PageAbstract

getResponseHelper()

getResponseHelper(string  $name, array  $post = array(), array  $query = array()) : \Dewdrop\Admin\ResponseHelper\Standard

Complete the init and process portions of the dispatch loop so that we can return the response helper for testing.

Parameters

string $name
array $post
array $query

Returns

\Dewdrop\Admin\ResponseHelper\Standard

getComponent()

getComponent(\Dewdrop\Test\Admin\Request  $request) : \Dewdrop\Admin\ComponentAbstract

Get a component object. This can be useful if you don't want to execute the full page dispatch process but instead want to interact with the component object directly or run selected portions of a page's functionality after routing.

Parameters

\Dewdrop\Test\Admin\Request $request

Returns

\Dewdrop\Admin\ComponentAbstract