| @@ 91-106 (lines=16) @@ | ||
| 88 | $this->handler->create($spiCreateStruct); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function testDelete() |
|
| 92 | { |
|
| 93 | $statement = $this->createDbalStatementMock(); |
|
| 94 | $statement |
|
| 95 | ->expects($this->once()) |
|
| 96 | ->method('rowCount') |
|
| 97 | ->will($this->returnValue(1)); |
|
| 98 | ||
| 99 | $this->dbalMock |
|
| 100 | ->expects($this->once()) |
|
| 101 | ->method('prepare') |
|
| 102 | ->with($this->anything()) |
|
| 103 | ->will($this->returnValue($statement)); |
|
| 104 | ||
| 105 | $this->handler->delete('prefix/my/file.png'); |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| @@ 111-126 (lines=16) @@ | ||
| 108 | /** |
|
| 109 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 110 | */ |
|
| 111 | public function testDeleteNotFound() |
|
| 112 | { |
|
| 113 | $statement = $this->createDbalStatementMock(); |
|
| 114 | $statement |
|
| 115 | ->expects($this->once()) |
|
| 116 | ->method('rowCount') |
|
| 117 | ->will($this->returnValue(0)); |
|
| 118 | ||
| 119 | $this->dbalMock |
|
| 120 | ->expects($this->once()) |
|
| 121 | ->method('prepare') |
|
| 122 | ->with($this->anything()) |
|
| 123 | ->will($this->returnValue($statement)); |
|
| 124 | ||
| 125 | $this->handler->delete('prefix/my/file.png'); |
|
| 126 | } |
|
| 127 | ||
| 128 | public function testLoad() |
|
| 129 | { |
|
| @@ 162-177 (lines=16) @@ | ||
| 159 | /** |
|
| 160 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 161 | */ |
|
| 162 | public function testLoadNotFound() |
|
| 163 | { |
|
| 164 | $statement = $this->createDbalStatementMock(); |
|
| 165 | $statement |
|
| 166 | ->expects($this->once()) |
|
| 167 | ->method('rowCount') |
|
| 168 | ->will($this->returnValue(0)); |
|
| 169 | ||
| 170 | $this->dbalMock |
|
| 171 | ->expects($this->once()) |
|
| 172 | ->method('prepare') |
|
| 173 | ->with($this->anything()) |
|
| 174 | ->will($this->returnValue($statement)); |
|
| 175 | ||
| 176 | $this->handler->load('prefix/my/file.png'); |
|
| 177 | } |
|
| 178 | ||
| 179 | public function testExists() |
|
| 180 | { |
|
| @@ 179-194 (lines=16) @@ | ||
| 176 | $this->handler->load('prefix/my/file.png'); |
|
| 177 | } |
|
| 178 | ||
| 179 | public function testExists() |
|
| 180 | { |
|
| 181 | $statement = $this->createDbalStatementMock(); |
|
| 182 | $statement |
|
| 183 | ->expects($this->once()) |
|
| 184 | ->method('rowCount') |
|
| 185 | ->will($this->returnValue(1)); |
|
| 186 | ||
| 187 | $this->dbalMock |
|
| 188 | ->expects($this->once()) |
|
| 189 | ->method('prepare') |
|
| 190 | ->with($this->anything()) |
|
| 191 | ->will($this->returnValue($statement)); |
|
| 192 | ||
| 193 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 194 | } |
|
| 195 | ||
| 196 | public function testExistsNot() |
|
| 197 | { |
|
| @@ 196-211 (lines=16) @@ | ||
| 193 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 194 | } |
|
| 195 | ||
| 196 | public function testExistsNot() |
|
| 197 | { |
|
| 198 | $statement = $this->createDbalStatementMock(); |
|
| 199 | $statement |
|
| 200 | ->expects($this->once()) |
|
| 201 | ->method('rowCount') |
|
| 202 | ->will($this->returnValue(0)); |
|
| 203 | ||
| 204 | $this->dbalMock |
|
| 205 | ->expects($this->once()) |
|
| 206 | ->method('prepare') |
|
| 207 | ->with($this->anything()) |
|
| 208 | ->will($this->returnValue($statement)); |
|
| 209 | ||
| 210 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function testDeletedirectory() |
|
| 214 | { |
|
| @@ 213-228 (lines=16) @@ | ||
| 210 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 211 | } |
|
| 212 | ||
| 213 | public function testDeletedirectory() |
|
| 214 | { |
|
| 215 | $statement = $this->createDbalStatementMock(); |
|
| 216 | $statement |
|
| 217 | ->expects($this->once()) |
|
| 218 | ->method('bindValue') |
|
| 219 | ->with(1, 'folder/subfolder/%'); |
|
| 220 | ||
| 221 | $this->dbalMock |
|
| 222 | ->expects($this->once()) |
|
| 223 | ->method('prepare') |
|
| 224 | ->with($this->anything()) |
|
| 225 | ->will($this->returnValue($statement)); |
|
| 226 | ||
| 227 | $this->handler->deleteDirectory('folder/subfolder/'); |
|
| 228 | } |
|
| 229 | ||
| 230 | /** |
|
| 231 | * @return \PHPUnit_Framework_MockObject_MockObject |
|