|
@@ 183-203 (lines=21) @@
|
| 180 |
|
* @expectedException \Exception |
| 181 |
|
* @expectedExceptionMessage File 'somefilename_readable' isn't a Twine archive file |
| 182 |
|
*/ |
| 183 |
|
public function testRunWithWrongFileFormat() |
| 184 |
|
{ |
| 185 |
|
$dm = $this->getDmMock(); |
| 186 |
|
$importfile = $this->getDummyImportfile(); |
| 187 |
|
|
| 188 |
|
$this->fileCheckMock->expects(self::once()) |
| 189 |
|
->method('check') |
| 190 |
|
->willThrowException(new \Exception('File \'somefilename_readable\' isn\'t a Twine archive file')); |
| 191 |
|
|
| 192 |
|
$this->fileExtractorMock->expects(self::any()) |
| 193 |
|
->method('extract') |
| 194 |
|
->willReturn('readable.extracted'); |
| 195 |
|
|
| 196 |
|
self::$freadStack = ['erste Zeile', 'zweite Zeile']; |
| 197 |
|
|
| 198 |
|
$this->importTwine->run($importfile); |
| 199 |
|
$dm->expects($this->never()) |
| 200 |
|
->method('persist'); |
| 201 |
|
$dm->expects($this->never()) |
| 202 |
|
->method('flush'); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
/** |
| 206 |
|
* @expectedException \Exception |
|
@@ 209-229 (lines=21) @@
|
| 206 |
|
* @expectedException \Exception |
| 207 |
|
* @expectedExceptionMessage File 'somefilename_readable' seems to be empty. |
| 208 |
|
*/ |
| 209 |
|
public function testRunWithEmptyFirstLine() |
| 210 |
|
{ |
| 211 |
|
$dm = $this->getDmMock(); |
| 212 |
|
$importfile = $this->getDummyImportfile(); |
| 213 |
|
|
| 214 |
|
$this->fileCheckMock->expects(self::once()) |
| 215 |
|
->method('check') |
| 216 |
|
->willThrowException(new \Exception('Failed asserting that exception message \'File \'somefilename_readable\' isn\'t a Twine archive file\' contains \'File \'somefilename_readable\' seems to be empty.')); |
| 217 |
|
|
| 218 |
|
$this->fileExtractorMock->expects(self::any()) |
| 219 |
|
->method('extract') |
| 220 |
|
->willReturn('readable.extracted'); |
| 221 |
|
|
| 222 |
|
self::$freadStack = ['']; |
| 223 |
|
|
| 224 |
|
$this->importTwine->run($importfile); |
| 225 |
|
$dm->expects($this->never()) |
| 226 |
|
->method('persist'); |
| 227 |
|
$dm->expects($this->never()) |
| 228 |
|
->method('flush'); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
/** |
| 232 |
|
* tests the run method with correct but incomplete data |