diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2012-04-17 14:10:43 +0200 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2012-04-17 14:10:43 +0200 |
commit | c45ce44912e3e54ecdf0a19af2d7df1960aa2962 (patch) | |
tree | 99ce194837941fac3a4e635759e73a8f7bf99852 /_testing/bootstrap.php | |
parent | 23725b9188f335447080ba9cc8e1f32cdec2e472 (diff) | |
download | rpg-c45ce44912e3e54ecdf0a19af2d7df1960aa2962.tar.gz rpg-c45ce44912e3e54ecdf0a19af2d7df1960aa2962.tar.bz2 |
added phpquery to test response
This should make it much easier to do integration tests based on the new
TestRequest utility.
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); + } } |