DOMParser
in package
Load a response into a DOMDocument for testing assertions based on that
Table of Contents
- $dom : DOMDocument
- DOM for the body,
- __construct() : mixed
- Constructor.
- dontSee() : bool
- Checks to see if the text is NOT found within the result.
- dontSeeElement() : bool
- Checks to see if the element is available within the result.
- getBody() : string
- Returns the body of the current document.
- parseSelector() : array<string|int, mixed>
- Look for the a selector in the passed text.
- see() : bool
- Checks to see if the text is found within the result.
- seeCheckboxIsChecked() : bool
- Checks for checkboxes that are currently checked.
- seeElement() : bool
- Checks to see if an element with the matching CSS specifier is found within the current DOM.
- seeInField() : bool
- Checks for an input named $field with a value of $value.
- seeLink() : bool
- Determines if a link with the specified text is found within the results.
- withFile() : DOMParser
- Loads the contents of a file as a string so that we can work with it.
- withString() : $this
- Sets a string as the body that we want to work with.
- doXPath() : DOMNodeList
- Search the DOM using an XPath expression.
Properties
$dom
DOM for the body,
protected
DOMDocument
$dom
Methods
__construct()
Constructor.
public
__construct() : mixed
Tags
Return values
mixed —dontSee()
Checks to see if the text is NOT found within the result.
public
dontSee([string $search = null ][, string|null $element = null ]) : bool
Parameters
- $search : string = null
- $element : string|null = null
Return values
bool —dontSeeElement()
Checks to see if the element is available within the result.
public
dontSeeElement(string $element) : bool
Parameters
- $element : string
Return values
bool —getBody()
Returns the body of the current document.
public
getBody() : string
Return values
string —parseSelector()
Look for the a selector in the passed text.
public
parseSelector(string $selector) : array<string|int, mixed>
Parameters
- $selector : string
Return values
array<string|int, mixed> —see()
Checks to see if the text is found within the result.
public
see([string $search = null ][, string $element = null ]) : bool
Parameters
- $search : string = null
- $element : string = null
Return values
bool —seeCheckboxIsChecked()
Checks for checkboxes that are currently checked.
public
seeCheckboxIsChecked(string $element) : bool
Parameters
- $element : string
Return values
bool —seeElement()
Checks to see if an element with the matching CSS specifier is found within the current DOM.
public
seeElement(string $element) : bool
Parameters
- $element : string
Return values
bool —seeInField()
Checks for an input named $field with a value of $value.
public
seeInField(string $field, string $value) : bool
Parameters
- $field : string
- $value : string
Return values
bool —seeLink()
Determines if a link with the specified text is found within the results.
public
seeLink(string $text[, string|null $details = null ]) : bool
Parameters
- $text : string
- $details : string|null = null
Return values
bool —withFile()
Loads the contents of a file as a string so that we can work with it.
public
withFile(string $path) : DOMParser
Parameters
- $path : string
Return values
DOMParser —withString()
Sets a string as the body that we want to work with.
public
withString(string $content) : $this
Parameters
- $content : string
Return values
$this —doXPath()
Search the DOM using an XPath expression.
protected
doXPath(string|null $search, string $element[, array<string|int, mixed> $paths = [] ]) : DOMNodeList
Parameters
- $search : string|null
- $element : string
- $paths : array<string|int, mixed> = []