CodeIgniter v4.5 API

DOMParser
in package

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

Tags
see
DOMParserTest

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
throws
BadMethodCallException

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
bool

dontSeeElement()

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

public dontSeeElement(string $element) : bool
Parameters
$element : string
Return values
bool

dontSeeXPath()

Checks to see if the XPath can't be found.

public dontSeeXPath(string $path) : bool
Parameters
$path : 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{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: array|null}

see()

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
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

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

seeXPath()

Checks to see if the XPath can be found.

public seeXPath(string $path) : bool
Parameters
$path : string
Return values
bool

withFile()

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
$this

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|false
Parameters
$search : string|null
$element : string
$paths : array<string|int, mixed> = []
Return values
DOMNodeList|false

        
On this page

Search results