| @@ 105-121 (lines=17) @@ | ||
| 102 | $this->assertFalse($resolver->isStored('/some-folder/path.jpg', 'thumb')); |
|
| 103 | } |
|
| 104 | ||
| 105 | public function testReturnResolvedImageUrlOnResolve() |
|
| 106 | { |
|
| 107 | $s3 = $this->createAmazonS3Mock(); |
|
| 108 | $s3 |
|
| 109 | ->expects($this->once()) |
|
| 110 | ->method('get_object_url') |
|
| 111 | ->with('images.example.com', 'thumb/some-folder/path.jpg', 0, array()) |
|
| 112 | ->will($this->returnValue('http://images.example.com/some-folder/path.jpg')) |
|
| 113 | ; |
|
| 114 | ||
| 115 | $resolver = new AmazonS3Resolver($s3, 'images.example.com'); |
|
| 116 | ||
| 117 | $this->assertEquals( |
|
| 118 | 'http://images.example.com/some-folder/path.jpg', |
|
| 119 | $resolver->resolve('/some-folder/path.jpg', 'thumb') |
|
| 120 | ); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testDoNothingIfFiltersAndPathsEmptyOnRemove() |
|
| 124 | { |
|
| @@ 128-144 (lines=17) @@ | ||
| 125 | $this->assertFalse($resolver->isStored('/some-folder/path.jpg', 'thumb')); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function testReturnResolvedImageUrlOnResolve() |
|
| 129 | { |
|
| 130 | $s3 = $this->getS3ClientMock(); |
|
| 131 | $s3 |
|
| 132 | ->expects($this->once()) |
|
| 133 | ->method('getObjectUrl') |
|
| 134 | ->with('images.example.com', 'thumb/some-folder/path.jpg', 0, array()) |
|
| 135 | ->will($this->returnValue('http://images.example.com/some-folder/path.jpg')) |
|
| 136 | ; |
|
| 137 | ||
| 138 | $resolver = new AwsS3Resolver($s3, 'images.example.com'); |
|
| 139 | ||
| 140 | $this->assertEquals( |
|
| 141 | 'http://images.example.com/some-folder/path.jpg', |
|
| 142 | $resolver->resolve('/some-folder/path.jpg', 'thumb') |
|
| 143 | ); |
|
| 144 | } |
|
| 145 | ||
| 146 | public function testDoNothingIfFiltersAndPathsEmptyOnRemove() |
|
| 147 | { |
|