diff options
Diffstat (limited to '_testing/bootstrap.php')
-rw-r--r-- | _testing/bootstrap.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/_testing/bootstrap.php b/_testing/bootstrap.php index 6a4bae728..6ea2c2661 100644 --- a/_testing/bootstrap.php +++ b/_testing/bootstrap.php @@ -6,6 +6,8 @@ * runtime inspection. */ +require_once dirname(__FILE__).'/core/phpQuery-onefile.php'; + // helper for recursive copy() function rcopy($destdir, $source) { if (!is_dir($source)) { @@ -232,8 +234,9 @@ class TestRequest { // holds a copy of all produced outputs of a TestRequest class TestResponse { - var $content; - var $headers; + protected $content; + protected $headers; + protected $pq = null; function __construct($content, $headers) { $this->content = $content; @@ -247,4 +250,16 @@ class TestResponse { function getHeaders() { return $this->headers; } + + /** + * Query the response for a JQuery compatible CSS selector + * + * @link https://code.google.com/p/phpquery/wiki/Selectors + * @param string selector + * @returns object a PHPQuery object + */ + function queryHTML($selector){ + if(is_null($pq)) $pq = phpQuery::newDocument($this->content); + return pq($selector); + } } |