\CodeIgniter\TestDOMParser

Load a response into a DOMDocument for testing assertions based on that

Summary

Methods
Properties
Constants
__construct()
getBody()
withString()
withFile()
see()
dontSee()
seeElement()
dontSeeElement()
seeLink()
seeInField()
seeCheckboxIsChecked()
parseSelector()
No public properties found
No constants found
doXPath()
$dom
N/A
No private methods found
No private properties found
N/A

Properties

$dom

$dom : \DOMDocument

DOM for the body,

Type

\DOMDocument

Methods

__construct()

__construct() 

Constructor.

Throws

\BadMethodCallException

getBody()

getBody() : string

Returns the body of the current document.

Returns

string

withString()

withString(string  $content) : $this

Sets a string as the body that we want to work with.

Parameters

string $content

Returns

$this

withFile()

withFile(string  $path) : \CodeIgniter\Test\DOMParser

Loads the contents of a file as a string so that we can work with it.

Parameters

string $path

Returns

\CodeIgniter\Test\DOMParser

see()

see(string  $search = null, string  $element = null) : boolean

Checks to see if the text is found within the result.

Parameters

string $search
string $element

Returns

boolean

dontSee()

dontSee(string  $search = null, string|null  $element = null) : boolean

Checks to see if the text is NOT found within the result.

Parameters

string $search
string|null $element

Returns

boolean

seeElement()

seeElement(string  $element) : boolean

Checks to see if an element with the matching CSS specifier is found within the current DOM.

Parameters

string $element

Returns

boolean

dontSeeElement()

dontSeeElement(string  $element) : boolean

Checks to see if the element is available within the result.

Parameters

string $element

Returns

boolean

seeLink()

seeLink(string  $text, string|null  $details = null) : boolean

Determines if a link with the specified text is found within the results.

Parameters

string $text
string|null $details

Returns

boolean

seeInField()

seeInField(string  $field, string  $value) : boolean

Checks for an input named $field with a value of $value.

Parameters

string $field
string $value

Returns

boolean

seeCheckboxIsChecked()

seeCheckboxIsChecked(string  $element) : boolean

Checks for checkboxes that are currently checked.

Parameters

string $element

Returns

boolean

parseSelector()

parseSelector(string  $selector) : \CodeIgniter\Test\type

Look for the a selector in the passed text.

Parameters

string $selector

Returns

\CodeIgniter\Test\type

doXPath()

doXPath(string  $search = null, string  $element, array  $paths = array()) : \CodeIgniter\Test\type

Search the DOM using an XPath expression.

Parameters

string $search
string $element
array $paths

Returns

\CodeIgniter\Test\type