summaryrefslogtreecommitdiff
path: root/_testing/core/TestResponse.php
diff options
context:
space:
mode:
Diffstat (limited to '_testing/core/TestResponse.php')
-rw-r--r--_testing/core/TestResponse.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/_testing/core/TestResponse.php b/_testing/core/TestResponse.php
new file mode 100644
index 000000000..ed112b42e
--- /dev/null
+++ b/_testing/core/TestResponse.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * holds a copy of all produced outputs of a TestRequest
+ */
+class TestResponse {
+ protected $content;
+ protected $headers;
+
+ /**
+ * @var phpQueryObject
+ */
+ protected $pq = null;
+
+ function __construct($content, $headers) {
+ $this->content = $content;
+ $this->headers = $headers;
+ }
+
+ function getContent() {
+ return $this->content;
+ }
+
+ 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($this->pq)) $this->pq = phpQuery::newDocument($this->content);
+ return $this->pq->find($selector);
+ }
+}