|
@@ 157-177 (lines=21) @@
|
| 154 |
|
* @expectedException Exception |
| 155 |
|
* @expectedExceptionMessage File 'somefilename_readable' isn't a Twine archive file |
| 156 |
|
*/ |
| 157 |
|
public function testRunWithWrongFileFormat() |
| 158 |
|
{ |
| 159 |
|
$dm = $this->getDmMock(); |
| 160 |
|
$importfile = $this->getDummyImportfile(); |
| 161 |
|
|
| 162 |
|
$this->fileCheckMock->expects(self::once()) |
| 163 |
|
->method('check') |
| 164 |
|
->willThrowException(new \Exception('File \'somefilename_readable\' isn\'t a Twine archive file')); |
| 165 |
|
|
| 166 |
|
$this->fileExtractorMock->expects(self::any()) |
| 167 |
|
->method('extract') |
| 168 |
|
->willReturn('readable.extracted'); |
| 169 |
|
|
| 170 |
|
self::$freadStack = ['erste Zeile', 'zweite Zeile']; |
| 171 |
|
|
| 172 |
|
$this->importTwine->run($importfile); |
| 173 |
|
$dm->expects($this->never()) |
| 174 |
|
->method('persist'); |
| 175 |
|
$dm->expects($this->never()) |
| 176 |
|
->method('flush'); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
/** |
| 180 |
|
* @expectedException \Exception |
|
@@ 183-203 (lines=21) @@
|
| 180 |
|
* @expectedException \Exception |
| 181 |
|
* @expectedExceptionMessage File 'somefilename_readable' seems to be empty. |
| 182 |
|
*/ |
| 183 |
|
public function testRunWithEmptyFirstLine() |
| 184 |
|
{ |
| 185 |
|
$dm = $this->getDmMock(); |
| 186 |
|
$importfile = $this->getDummyImportfile(); |
| 187 |
|
|
| 188 |
|
$this->fileCheckMock->expects(self::once()) |
| 189 |
|
->method('check') |
| 190 |
|
->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.')); |
| 191 |
|
|
| 192 |
|
$this->fileExtractorMock->expects(self::any()) |
| 193 |
|
->method('extract') |
| 194 |
|
->willReturn('readable.extracted'); |
| 195 |
|
|
| 196 |
|
self::$freadStack = ['']; |
| 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 |
|
* tests the run method with correct but incomplete data |