| @@ 73-88 (lines=16) @@ | ||
| 70 | $this->assertEquals($mtimeExpected, $spiBinary->mtime); |
|
| 71 | } |
|
| 72 | ||
| 73 | public function testDelete() |
|
| 74 | { |
|
| 75 | $statement = $this->createDbalStatementMock(); |
|
| 76 | $statement |
|
| 77 | ->expects($this->once()) |
|
| 78 | ->method('rowCount') |
|
| 79 | ->will($this->returnValue(1)); |
|
| 80 | ||
| 81 | $this->dbalMock |
|
| 82 | ->expects($this->once()) |
|
| 83 | ->method('prepare') |
|
| 84 | ->with($this->anything()) |
|
| 85 | ->will($this->returnValue($statement)); |
|
| 86 | ||
| 87 | $this->handler->delete('prefix/my/file.png'); |
|
| 88 | } |
|
| 89 | ||
| 90 | /** |
|
| 91 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| @@ 93-108 (lines=16) @@ | ||
| 90 | /** |
|
| 91 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 92 | */ |
|
| 93 | public function testDeleteNotFound() |
|
| 94 | { |
|
| 95 | $statement = $this->createDbalStatementMock(); |
|
| 96 | $statement |
|
| 97 | ->expects($this->once()) |
|
| 98 | ->method('rowCount') |
|
| 99 | ->will($this->returnValue(0)); |
|
| 100 | ||
| 101 | $this->dbalMock |
|
| 102 | ->expects($this->once()) |
|
| 103 | ->method('prepare') |
|
| 104 | ->with($this->anything()) |
|
| 105 | ->will($this->returnValue($statement)); |
|
| 106 | ||
| 107 | $this->handler->delete('prefix/my/file.png'); |
|
| 108 | } |
|
| 109 | ||
| 110 | public function testLoad() |
|
| 111 | { |
|
| @@ 144-159 (lines=16) @@ | ||
| 141 | /** |
|
| 142 | * @expectedException \eZ\Publish\Core\IO\Exception\BinaryFileNotFoundException |
|
| 143 | */ |
|
| 144 | public function testLoadNotFound() |
|
| 145 | { |
|
| 146 | $statement = $this->createDbalStatementMock(); |
|
| 147 | $statement |
|
| 148 | ->expects($this->once()) |
|
| 149 | ->method('rowCount') |
|
| 150 | ->will($this->returnValue(0)); |
|
| 151 | ||
| 152 | $this->dbalMock |
|
| 153 | ->expects($this->once()) |
|
| 154 | ->method('prepare') |
|
| 155 | ->with($this->anything()) |
|
| 156 | ->will($this->returnValue($statement)); |
|
| 157 | ||
| 158 | $this->handler->load('prefix/my/file.png'); |
|
| 159 | } |
|
| 160 | ||
| 161 | public function testExists() |
|
| 162 | { |
|
| @@ 161-176 (lines=16) @@ | ||
| 158 | $this->handler->load('prefix/my/file.png'); |
|
| 159 | } |
|
| 160 | ||
| 161 | public function testExists() |
|
| 162 | { |
|
| 163 | $statement = $this->createDbalStatementMock(); |
|
| 164 | $statement |
|
| 165 | ->expects($this->once()) |
|
| 166 | ->method('rowCount') |
|
| 167 | ->will($this->returnValue(1)); |
|
| 168 | ||
| 169 | $this->dbalMock |
|
| 170 | ->expects($this->once()) |
|
| 171 | ->method('prepare') |
|
| 172 | ->with($this->anything()) |
|
| 173 | ->will($this->returnValue($statement)); |
|
| 174 | ||
| 175 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 176 | } |
|
| 177 | ||
| 178 | public function testExistsNot() |
|
| 179 | { |
|
| @@ 178-193 (lines=16) @@ | ||
| 175 | self::assertTrue($this->handler->exists('prefix/my/file.png')); |
|
| 176 | } |
|
| 177 | ||
| 178 | public function testExistsNot() |
|
| 179 | { |
|
| 180 | $statement = $this->createDbalStatementMock(); |
|
| 181 | $statement |
|
| 182 | ->expects($this->once()) |
|
| 183 | ->method('rowCount') |
|
| 184 | ->will($this->returnValue(0)); |
|
| 185 | ||
| 186 | $this->dbalMock |
|
| 187 | ->expects($this->once()) |
|
| 188 | ->method('prepare') |
|
| 189 | ->with($this->anything()) |
|
| 190 | ->will($this->returnValue($statement)); |
|
| 191 | ||
| 192 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 193 | } |
|
| 194 | ||
| 195 | public function testDeletedirectory() |
|
| 196 | { |
|
| @@ 195-210 (lines=16) @@ | ||
| 192 | self::assertFalse($this->handler->exists('prefix/my/file.png')); |
|
| 193 | } |
|
| 194 | ||
| 195 | public function testDeletedirectory() |
|
| 196 | { |
|
| 197 | $statement = $this->createDbalStatementMock(); |
|
| 198 | $statement |
|
| 199 | ->expects($this->once()) |
|
| 200 | ->method('bindValue') |
|
| 201 | ->with(1, 'folder/subfolder/%'); |
|
| 202 | ||
| 203 | $this->dbalMock |
|
| 204 | ->expects($this->once()) |
|
| 205 | ->method('prepare') |
|
| 206 | ->with($this->anything()) |
|
| 207 | ->will($this->returnValue($statement)); |
|
| 208 | ||
| 209 | $this->handler->deleteDirectory('folder/subfolder/'); |
|
| 210 | } |
|
| 211 | ||
| 212 | /** |
|
| 213 | * @return \PHPUnit_Framework_MockObject_MockObject |
|