Skip to content

Commit 870c000

Browse files
committed
Merge pull request #137 from FriendsOfSymfony/fix-exceptions-test-mock-request
fix mock request for exceptions test
2 parents 9073dc9 + ee5c4c2 commit 870c000

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/Unit/ProxyClient/VarnishTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class VarnishTest extends \PHPUnit_Framework_TestCase
3333

3434
public function testBanEverything()
3535
{
36-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'fos.lo', $this->client);
36+
$varnish = new Varnish(array('127.0.0.1:123'), 'fos.lo', $this->client);
3737
$varnish->ban(array())->flush();
3838

3939
$requests = $this->getRequests();
@@ -49,7 +49,7 @@ public function testBanEverything()
4949

5050
public function testBanEverythingNoBaseUrl()
5151
{
52-
$varnish = new Varnish(array('http://127.0.0.1:123'), null, $this->client);
52+
$varnish = new Varnish(array('127.0.0.1:123'), null, $this->client);
5353
$varnish->ban(array())->flush();
5454

5555
$requests = $this->getRequests();
@@ -66,7 +66,7 @@ public function testBanEverythingNoBaseUrl()
6666

6767
public function testBanHeaders()
6868
{
69-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'fos.lo', $this->client);
69+
$varnish = new Varnish(array('127.0.0.1:123'), 'fos.lo', $this->client);
7070
$varnish->setDefaultBanHeaders(
7171
array('A' => 'B')
7272
);
@@ -85,7 +85,7 @@ public function testBanHeaders()
8585

8686
public function testBanPath()
8787
{
88-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'fos.lo', $this->client);
88+
$varnish = new Varnish(array('127.0.0.1:123'), 'fos.lo', $this->client);
8989

9090
$hosts = array('fos.lo', 'fos2.lo');
9191
$varnish->banPath('/articles/.*', 'text/html', $hosts)->flush();
@@ -105,7 +105,7 @@ public function testBanPath()
105105
*/
106106
public function testBanPathEmptyHost()
107107
{
108-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'fos.lo', $this->client);
108+
$varnish = new Varnish(array('127.0.0.1:123'), 'fos.lo', $this->client);
109109

110110
$hosts = array();
111111
$varnish->banPath('/articles/.*', 'text/html', $hosts);
@@ -150,8 +150,8 @@ function ($requests) use ($self) {
150150
->getMock();
151151

152152
$ips = array(
153-
'http://127.0.0.1:8080',
154-
'http://123.123.123.2',
153+
'127.0.0.1:8080',
154+
'123.123.123.2',
155155
);
156156

157157
$varnish = new Varnish($ips, 'my_hostname.dev', $client);
@@ -164,7 +164,7 @@ function ($requests) use ($self) {
164164

165165
public function testRefresh()
166166
{
167-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'fos.lo', $this->client);
167+
$varnish = new Varnish(array('127.0.0.1:123'), 'fos.lo', $this->client);
168168
$varnish->refresh('/fresh')->flush();
169169

170170
$requests = $this->getRequests();
@@ -181,7 +181,7 @@ public function testUnreachableException()
181181
$client = new Client();
182182
$client->addSubscriber($mock);
183183

184-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'my_hostname.dev', $client);
184+
$varnish = new Varnish(array('127.0.0.1:123'), 'my_hostname.dev', $client);
185185

186186
try {
187187
$varnish->purge('/paths')->flush();
@@ -226,14 +226,14 @@ public function testExceptions(\Exception $exception, $type)
226226
$client = $this->getMock('\Guzzle\Http\ClientInterface');
227227
$client->expects($this->any())
228228
->method('createRequest')
229-
->willReturn(new Request('GET', '/'))
229+
->willReturn(new Request('BAN', '/'))
230230
;
231231
$client->expects($this->once())
232232
->method('send')
233233
->willThrowException($collection)
234234
;
235235

236-
$varnish = new Varnish(array('http://127.0.0.1:123'), 'my_hostname.dev', $client);
236+
$varnish = new Varnish(array('127.0.0.1:123'), 'my_hostname.dev', $client);
237237

238238
$varnish->ban(array());
239239
try {
@@ -251,7 +251,7 @@ public function testExceptions(\Exception $exception, $type)
251251
*/
252252
public function testMissingHostExceptionIsThrown()
253253
{
254-
$varnish = new Varnish(array('http://127.0.0.1:123'), null, $this->client);
254+
$varnish = new Varnish(array('127.0.0.1:123'), null, $this->client);
255255
$varnish->purge('/path/without/hostname');
256256
}
257257

0 commit comments

Comments
 (0)