|
@@ 65-84 (lines=20) @@
|
| 62 |
|
$this->assertEquals('http://images.example.com/thumbs/foo/bar/bazz.png', $result); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function testProxyCallAndRewriteReturnedUrlWithMatchReplaceOnResolve() |
| 66 |
|
{ |
| 67 |
|
$expectedPath = '/foo/bar/bazz.png'; |
| 68 |
|
$expectedFilter = 'test'; |
| 69 |
|
|
| 70 |
|
$this->primaryResolver |
| 71 |
|
->expects($this->once()) |
| 72 |
|
->method('resolve') |
| 73 |
|
->with($expectedPath, $expectedFilter) |
| 74 |
|
->will($this->returnValue('https://s3-eu-west-1.amazonaws.com/s3-cache.example.com/thumbs/foo/bar/bazz.png')) |
| 75 |
|
; |
| 76 |
|
|
| 77 |
|
$this->resolver = new ProxyResolver($this->primaryResolver, array( |
| 78 |
|
'https://s3-eu-west-1.amazonaws.com/s3-cache.example.com' => 'http://images.example.com', |
| 79 |
|
)); |
| 80 |
|
|
| 81 |
|
$result = $this->resolver->resolve($expectedPath, $expectedFilter); |
| 82 |
|
|
| 83 |
|
$this->assertEquals('http://images.example.com/thumbs/foo/bar/bazz.png', $result); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
public function testProxyCallAndRewriteReturnedUrlWithRegExpOnResolve() |
| 87 |
|
{ |
|
@@ 86-105 (lines=20) @@
|
| 83 |
|
$this->assertEquals('http://images.example.com/thumbs/foo/bar/bazz.png', $result); |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
public function testProxyCallAndRewriteReturnedUrlWithRegExpOnResolve() |
| 87 |
|
{ |
| 88 |
|
$expectedPath = '/foo/bar/bazz.png'; |
| 89 |
|
$expectedFilter = 'test'; |
| 90 |
|
|
| 91 |
|
$this->primaryResolver |
| 92 |
|
->expects($this->once()) |
| 93 |
|
->method('resolve') |
| 94 |
|
->with($expectedPath, $expectedFilter) |
| 95 |
|
->will($this->returnValue('http://foo.com/thumbs/foo/bar/bazz.png')) |
| 96 |
|
; |
| 97 |
|
|
| 98 |
|
$this->resolver = new ProxyResolver($this->primaryResolver, array( |
| 99 |
|
'regexp/http:\/\/.*?\//' => 'http://bar.com/', |
| 100 |
|
)); |
| 101 |
|
|
| 102 |
|
$result = $this->resolver->resolve($expectedPath, $expectedFilter); |
| 103 |
|
|
| 104 |
|
$this->assertEquals('http://bar.com/thumbs/foo/bar/bazz.png', $result); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
public function testProxyCallAndReturnedValueOnIsStored() |
| 108 |
|
{ |