blob: ed112b42e351187a4d6eeb1860e0378852e06756 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
}
}
|