public function nodeListFromXpath($xpath) { if (!is_string($xpath)) { throw yTest_Exception::invalid('string', $xpath); } $nodeList = $this->domxpath->evaluate($xpath); $this->testCase->assertType('DOMNodeList', $nodeList); return $nodeList; }
/** * @return false | array('arg1' => 'value1', ...) */ public static function getArgsFromUrl($url) { $res = parse_url($url, PHP_URL_QUERY); if ($res === false) { throw yTest_Exception::invalid('URL', $url); } $args = explode('&', $res); $map = array(); foreach ($args as $a) { list($key, $val) = explode('=', $a); $map[$key] = $val; } return $map; }
/** * @param string One PCRE regexp string (including delimiters). */ public function __construct() { $regexps = func_get_args(); if (is_array($regexps)) { foreach ($regexps as $regexp) { if (!is_string($regexp)) { throw yTest_Exception::invalid('regexp', $regexp); } } $this->regexps = $regexps; } else { if (!is_string($regexps)) { throw yTest_Exception::invalid('regexp', $regexps); } $this->regexps = array($regexps); } }