PHP Class PHPUnit_Util_XML, qcodo

Author: Sebastian Bergmann ([email protected])
Afficher le fichier Open project: qcodo/qcodo Class Usage Examples

Méthodes publiques

Méthode Description
assertValidKeys ( array $hash, array $validKeys ) : array Validate list of keys in the associative array.
convertSelectToTag ( string $selector, mixed $content = TRUE ) : array Parse a CSS selector into an associative array suitable for use with findNodes().
cssSelect ( array $selector, string $content, mixed $actual, boolean $isHtml = TRUE ) : false | array Parse an $actual document and return an array of DOMNodes matching the CSS $selector. If an error occurs, it will return FALSE.
findNodes ( DOMDocument $dom, array $options, boolean $isHtml = TRUE ) : array Parse out the options from the tag using DOM object tree.
load ( string | DOMDocument $actual, boolean $isHtml = FALSE, string $filename = '' ) : DOMDocument Load an $actual document into a DOMDocument. This is called from the selector assertions.
loadFile ( string $filename, boolean $isHtml = FALSE ) : DOMDocument Loads an XML (or HTML) file into a DOMDocument object.
nodeToText ( DOMNode $node ) : string
prepareString ( string $string ) : string
removeCharacterDataNodes ( DOMNode $node )
xmlToVariable ( DOMElement $element ) : mixed "Convert" a DOMElement object into a PHP variable.

Méthodes protégées

Méthode Description
convertToUtf8 ( string $string ) : string Converts a string to UTF-8 encoding.
getDescendants ( DOMNode $node ) : array Recursively get flat array of all descendants of this node.
getElementsByCaseInsensitiveTagName ( DOMDocument $dom, string $tag ) : DOMNodeList Gets elements by case insensitive tagname.
getNodeText ( DOMNode $node ) : string Get the text value of this node's child text node.
isUtf8 ( string $string ) : boolean Checks a string for UTF-8 encoding.

Method Details

assertValidKeys() public static méthode

Validate list of keys in the associative array.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
public static assertValidKeys ( array $hash, array $validKeys ) : array
$hash array
$validKeys array
Résultat array

convertSelectToTag() public static méthode

Parse a CSS selector into an associative array suitable for use with findNodes().
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
public static convertSelectToTag ( string $selector, mixed $content = TRUE ) : array
$selector string
$content mixed
Résultat array

convertToUtf8() protected static méthode

Converts a string to UTF-8 encoding.
protected static convertToUtf8 ( string $string ) : string
$string string
Résultat string

cssSelect() public static méthode

To only return nodes containing a certain content, give the $content to match as a string. Otherwise, setting $content to TRUE will return all nodes matching $selector. The $actual document may be a DOMDocument or a string containing XML or HTML, identified by $isHtml.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
Author: Tobias Schlitt ([email protected])
public static cssSelect ( array $selector, string $content, mixed $actual, boolean $isHtml = TRUE ) : false | array
$selector array
$content string
$actual mixed
$isHtml boolean
Résultat false | array

findNodes() public static méthode

Parse out the options from the tag using DOM object tree.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
Author: Tobias Schlitt ([email protected])
public static findNodes ( DOMDocument $dom, array $options, boolean $isHtml = TRUE ) : array
$dom DOMDocument
$options array
$isHtml boolean
Résultat array

getDescendants() protected static méthode

Recursively get flat array of all descendants of this node.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
protected static getDescendants ( DOMNode $node ) : array
$node DOMNode
Résultat array

getElementsByCaseInsensitiveTagName() protected static méthode

Gets elements by case insensitive tagname.
protected static getElementsByCaseInsensitiveTagName ( DOMDocument $dom, string $tag ) : DOMNodeList
$dom DOMDocument
$tag string
Résultat DOMNodeList

getNodeText() protected static méthode

Get the text value of this node's child text node.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
protected static getNodeText ( DOMNode $node ) : string
$node DOMNode
Résultat string

isUtf8() protected static méthode

Checks a string for UTF-8 encoding.
protected static isUtf8 ( string $string ) : boolean
$string string
Résultat boolean

load() public static méthode

If $actual is already a DOMDocument, it is returned with no changes. Otherwise, $actual is loaded into a new DOMDocument as either HTML or XML, depending on the value of $isHtml. Note: prior to PHPUnit 3.3.0, this method loaded a file and not a string as it currently does. To load a file into a DOMDocument, use loadFile() instead.
Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
public static load ( string | DOMDocument $actual, boolean $isHtml = FALSE, string $filename = '' ) : DOMDocument
$actual string | DOMDocument
$isHtml boolean
$filename string
Résultat DOMDocument

loadFile() public static méthode

Loads an XML (or HTML) file into a DOMDocument object.
public static loadFile ( string $filename, boolean $isHtml = FALSE ) : DOMDocument
$filename string
$isHtml boolean
Résultat DOMDocument

nodeToText() public static méthode

public static nodeToText ( DOMNode $node ) : string
$node DOMNode
Résultat string

prepareString() public static méthode

Author: Kore Nordmann ([email protected])
public static prepareString ( string $string ) : string
$string string
Résultat string

removeCharacterDataNodes() public static méthode

Author: Mattis Stordalen Flister ([email protected])
public static removeCharacterDataNodes ( DOMNode $node )
$node DOMNode

xmlToVariable() public static méthode

"Convert" a DOMElement object into a PHP variable.
public static xmlToVariable ( DOMElement $element ) : mixed
$element DOMElement
Résultat mixed