|
20 | 20 | * Abstract caching proxy test case |
21 | 21 | * |
22 | 22 | */ |
23 | | -abstract class AbstractProxyClientTestCase extends \PHPUnit_Framework_TestCase |
| 23 | +abstract class ProxyTestCase extends \PHPUnit_Framework_TestCase |
24 | 24 | { |
25 | 25 | /** |
26 | 26 | * A Guzzle HTTP client. |
27 | 27 | * |
28 | 28 | * @var Client |
29 | 29 | */ |
30 | | - protected $client; |
| 30 | + protected $httpClient; |
31 | 31 |
|
32 | 32 | /** |
33 | 33 | * Assert a cache miss |
@@ -72,24 +72,24 @@ public static function isCacheMiss() |
72 | 72 | */ |
73 | 73 | public function getResponse($url, array $headers = array(), $options = array()) |
74 | 74 | { |
75 | | - return $this->getClient()->get($url, $headers, $options)->send(); |
| 75 | + return $this->getHttpClient()->get($url, $headers, $options)->send(); |
76 | 76 | } |
77 | 77 |
|
78 | 78 | /** |
79 | 79 | * Get HTTP client for your application |
80 | 80 | * |
81 | 81 | * @return Client |
82 | 82 | */ |
83 | | - public function getClient() |
| 83 | + public function getHttpClient() |
84 | 84 | { |
85 | | - if (null === $this->client) { |
86 | | - $this->client = new Client( |
| 85 | + if (null === $this->httpClient) { |
| 86 | + $this->httpClient = new Client( |
87 | 87 | 'http://' . $this->getHostName() . ':' . $this->getCachingProxyPort(), |
88 | 88 | array('curl.options' => array(CURLOPT_FORBID_REUSE => true)) |
89 | 89 | ); |
90 | 90 | } |
91 | 91 |
|
92 | | - return $this->client; |
| 92 | + return $this->httpClient; |
93 | 93 | } |
94 | 94 |
|
95 | 95 | /** |
@@ -125,12 +125,23 @@ protected function getHostName() |
125 | 125 | } |
126 | 126 |
|
127 | 127 | /** |
| 128 | + * Get proxy server |
| 129 | + * |
128 | 130 | * @return \FOS\HttpCache\Test\Proxy\ProxyInterface |
129 | 131 | */ |
130 | 132 | abstract protected function getProxy(); |
131 | 133 |
|
132 | 134 | /** |
| 135 | + * Get proxy client |
| 136 | + * |
133 | 137 | * @return \FOS\HttpCache\ProxyClient\ProxyClientInterface |
134 | 138 | */ |
135 | 139 | abstract protected function getProxyClient(); |
| 140 | + |
| 141 | + /** |
| 142 | + * Get port that caching proxy listens on |
| 143 | + * |
| 144 | + * @return int |
| 145 | + */ |
| 146 | + abstract protected function getCachingProxyPort(); |
136 | 147 | } |
0 commit comments