| @@ 60-75 (lines=16) @@ | ||
| 57 | ); |
|
| 58 | } |
|
| 59 | ||
| 60 | public function testDelete() |
|
| 61 | { |
|
| 62 | $statement = $this->createDbalStatementMock(); |
|
| 63 | $statement |
|
| 64 | ->expects($this->once()) |
|
| 65 | ->method('rowCount') |
|
| 66 | ->will($this->returnValue(1)); |
|
| 67 | ||
| 68 | $this->dbalMock |
|
| 69 | ->expects($this->once()) |
|
| 70 | ->method('prepare') |
|
| 71 | ->with($this->anything()) |
|
| 72 | ->will($this->returnValue($statement)); |
|
| 73 | ||
| 74 | $this->handler->delete('prefix/my/file.png'); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| @@ 80-95 (lines=16) @@ | ||
| 77 | /** |
|
| 78 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 79 | */ |
|
| 80 | public function testDeleteNotFound() |
|
| 81 | { |
|
| 82 | $statement = $this->createDbalStatementMock(); |
|
| 83 | $statement |
|
| 84 | ->expects($this->once()) |
|
| 85 | ->method('rowCount') |
|
| 86 | ->will($this->returnValue(0)); |
|
| 87 | ||
| 88 | $this->dbalMock |
|
| 89 | ->expects($this->once()) |
|
| 90 | ->method('prepare') |
|
| 91 | ->with($this->anything()) |
|
| 92 | ->will($this->returnValue($statement)); |
|
| 93 | ||
| 94 | $this->handler->delete('prefix/my/file.png'); |
|
| 95 | } |
|
| 96 | ||
| 97 | public function testLoad() |
|
| 98 | { |
|
| @@ 131-146 (lines=16) @@ | ||
| 128 | /** |
|
| 129 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 130 | */ |
|
| 131 | public function testLoadNotFound() |
|
| 132 | { |
|
| 133 | $statement = $this->createDbalStatementMock(); |
|
| 134 | $statement |
|
| 135 | ->expects($this->once()) |
|
| 136 | ->method('rowCount') |
|
| 137 | ->will($this->returnValue(0)); |
|
| 138 | ||
| 139 | $this->dbalMock |
|
| 140 | ->expects($this->once()) |
|
| 141 | ->method('prepare') |
|
| 142 | ->with($this->anything()) |
|
| 143 | ->will($this->returnValue($statement)); |
|
| 144 | ||
| 145 | $this->handler->load('prefix/my/file.png'); |
|
| 146 | } |
|
| 147 | ||
| 148 | public function testExists() |
|
| 149 | { |
|
| @@ 148-163 (lines=16) @@ | ||
| 145 | $this->handler->load('prefix/my/file.png'); |
|
| 146 | } |
|
| 147 | ||
| 148 | public function testExists() |
|
| 149 | { |
|
| 150 | $statement = $this->createDbalStatementMock(); |
|
| 151 | $statement |
|
| 152 | ->expects($this->once()) |
|
| 153 | ->method('rowCount') |
|
| 154 | ->will($this->returnValue(1)); |
|
| 155 | ||
| 156 | $this->dbalMock |
|
| 157 | ->expects($this->once()) |
|
| 158 | ->method('prepare') |
|
| 159 | ->with($this->anything()) |
|
| 160 | ->will($this->returnValue($statement)); |
|
| 161 | ||
| 162 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 163 | } |
|
| 164 | ||
| 165 | public function testExistsNot() |
|
| 166 | { |
|
| @@ 165-180 (lines=16) @@ | ||
| 162 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 163 | } |
|
| 164 | ||
| 165 | public function testExistsNot() |
|
| 166 | { |
|
| 167 | $statement = $this->createDbalStatementMock(); |
|
| 168 | $statement |
|
| 169 | ->expects($this->once()) |
|
| 170 | ->method('rowCount') |
|
| 171 | ->will($this->returnValue(0)); |
|
| 172 | ||
| 173 | $this->dbalMock |
|
| 174 | ->expects($this->once()) |
|
| 175 | ->method('prepare') |
|
| 176 | ->with($this->anything()) |
|
| 177 | ->will($this->returnValue($statement)); |
|
| 178 | ||
| 179 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function testDeletedirectory() |
|
| 183 | { |
|
| @@ 182-197 (lines=16) @@ | ||
| 179 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function testDeletedirectory() |
|
| 183 | { |
|
| 184 | $statement = $this->createDbalStatementMock(); |
|
| 185 | $statement |
|
| 186 | ->expects($this->once()) |
|
| 187 | ->method('bindValue') |
|
| 188 | ->with(1, 'folder/subfolder/%'); |
|
| 189 | ||
| 190 | $this->dbalMock |
|
| 191 | ->expects($this->once()) |
|
| 192 | ->method('prepare') |
|
| 193 | ->with($this->anything()) |
|
| 194 | ->will($this->returnValue($statement)); |
|
| 195 | ||
| 196 | $this->handler->deleteDirectory('folder/subfolder/'); |
|
| 197 | } |
|
| 198 | ||
| 199 | /** |
|
| 200 | * @return \PHPUnit_Framework_MockObject_MockObject |
|