From c45ce44912e3e54ecdf0a19af2d7df1960aa2962 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 17 Apr 2012 14:10:43 +0200 Subject: added phpquery to test response This should make it much easier to do integration tests based on the new TestRequest utility. --- _testing/bootstrap.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to '_testing/bootstrap.php') 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); + } } -- cgit v1.2.3