DOMParser
in package
Load a response into a DOMDocument for testing assertions based on that
Tags
Table of Contents
Properties
- $dom : DOMDocument
- DOM for the body,
Methods
- __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.
- dontSeeXPath() : bool
- Checks to see if the XPath can't be found.
- getBody() : string
- Returns the body of the current document.
-
parseSelector()
: array{tag: string, id: string|null, class: string|null, attr: array
|null} - 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.
- seeXPath() : bool
- Checks to see if the XPath can be found.
- withFile() : $this
- 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|false
- Search the DOM using an XPath expression.
Properties
$dom
DOM for the body,
protected
DOMDocument
$dom
Methods
__construct()
Constructor.
public
__construct() : mixed
Tags
dontSee()
Checks to see if the text is NOT found within the result.
public
dontSee([string|null $search = null ][, string|null $element = null ]) : bool
Parameters
- $search : string|null = null
- $element : string|null = null
Return values
booldontSeeElement()
Checks to see if the element is available within the result.
public
dontSeeElement(string $element) : bool
Parameters
- $element : string
Return values
booldontSeeXPath()
Checks to see if the XPath can't be found.
public
dontSeeXPath(string $path) : bool
Parameters
- $path : string
Return values
boolgetBody()
Returns the body of the current document.
public
getBody() : string
Return values
stringparseSelector()
Look for the a selector in the passed text.
public
parseSelector(string $selector) : array{tag: string, id: string|null, class: string|null, attr: array|null}
Parameters
- $selector : string
Return values
array{tag: string, id: string|null, class: string|null, attr: arraysee()
Checks to see if the text is found within the result.
public
see([string|null $search = null ][, string|null $element = null ]) : bool
Parameters
- $search : string|null = null
- $element : string|null = null
Return values
boolseeCheckboxIsChecked()
Checks for checkboxes that are currently checked.
public
seeCheckboxIsChecked(string $element) : bool
Parameters
- $element : string
Return values
boolseeElement()
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
boolseeInField()
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
boolseeLink()
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
boolseeXPath()
Checks to see if the XPath can be found.
public
seeXPath(string $path) : bool
Parameters
- $path : string
Return values
boolwithFile()
Loads the contents of a file as a string so that we can work with it.
public
withFile(string $path) : $this
Parameters
- $path : string
Return values
$thiswithString()
Sets a string as the body that we want to work with.
public
withString(string $content) : $this
Parameters
- $content : string
Return values
$thisdoXPath()
Search the DOM using an XPath expression.
protected
doXPath(string|null $search, string $element[, array<string|int, mixed> $paths = [] ]) : DOMNodeList|false
Parameters
- $search : string|null
- $element : string
- $paths : array<string|int, mixed> = []