1 | <?php |
||
19 | abstract class AbstractCacheConstraint extends \PHPUnit_Framework_Constraint |
||
20 | { |
||
21 | protected $header = 'X-Cache'; |
||
22 | |||
23 | /** |
||
24 | * Constructor. |
||
25 | * |
||
26 | * @param string $header Cache debug header; defaults to X-Cache-Debug |
||
27 | */ |
||
28 | 30 | public function __construct($header = null) |
|
29 | { |
||
30 | 30 | if ($header) { |
|
|
|||
31 | 3 | $this->header = $header; |
|
32 | 3 | } |
|
33 | |||
34 | 30 | parent::__construct(); |
|
35 | 30 | } |
|
36 | |||
37 | /** |
||
38 | * Get cache header value. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | abstract public function getPattern(); |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | * |
||
47 | * @param Response $other The guzzle response object |
||
48 | */ |
||
49 | 30 | protected function matches($other) |
|
69 | |||
70 | /** |
||
71 | * {@inheritdoc} |
||
72 | */ |
||
73 | protected function failureDescription($other) |
||
81 | } |
||
82 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: