|
@@ 426-454 (lines=29) @@
|
| 423 |
|
* tests identifying a textnode by a twine ID |
| 424 |
|
* @throws \Exception |
| 425 |
|
*/ |
| 426 |
|
public function testRunWithTextnodeWithTwineID() |
| 427 |
|
{ |
| 428 |
|
$importfile = $this->getDummyImportfile(); |
| 429 |
|
|
| 430 |
|
$this->fileExtractorMock->expects(self::any()) |
| 431 |
|
->method('extract') |
| 432 |
|
->willReturn('readable.extracted'); |
| 433 |
|
|
| 434 |
|
self::$freadStack = [ |
| 435 |
|
'<tw-storydata name="someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n", |
| 436 |
|
'<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
| 437 |
|
'<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
| 438 |
|
'lorem ipsum</tw-passagedata></tw-storydata>', |
| 439 |
|
]; |
| 440 |
|
|
| 441 |
|
$textnode = new Textnode(); |
| 442 |
|
$textnode->setId('someTextnodeId'); |
| 443 |
|
|
| 444 |
|
$this->textnodeRepository->expects($this->any()) |
| 445 |
|
->method('find') |
| 446 |
|
->will($this->returnValue($textnode)); |
| 447 |
|
|
| 448 |
|
$this->textnodeRepository->expects($this->once()) |
| 449 |
|
->method('findByTwineId') |
| 450 |
|
->with($importfile, 'foobar') |
| 451 |
|
->willReturn($textnode); |
| 452 |
|
|
| 453 |
|
$this->importTwine->run($importfile); |
| 454 |
|
} |
| 455 |
|
|
| 456 |
|
/** |
| 457 |
|
* tests the freeing of xml parser |
|
@@ 460-490 (lines=31) @@
|
| 457 |
|
* tests the freeing of xml parser |
| 458 |
|
* @throws \Exception |
| 459 |
|
*/ |
| 460 |
|
public function testParserFree() |
| 461 |
|
{ |
| 462 |
|
$importfile = $this->getDummyImportfile(); |
| 463 |
|
|
| 464 |
|
$this->fileExtractorMock->expects(self::any()) |
| 465 |
|
->method('extract') |
| 466 |
|
->willReturn('readable.extracted'); |
| 467 |
|
|
| 468 |
|
self::$freadStack = [ |
| 469 |
|
'<tw-storydata name="someStoryName" startnode="1" creator="Twine" creator-version="2.0.8" ifid="8E30D51C-4980-4161-B57F-B11C752E879A" format="Harlowe" options=""><style role="stylesheet" id="twine-user-stylesheet" type="text/twine-css"></style>'."\n", |
| 470 |
|
'<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n", |
| 471 |
|
'<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben ID:foobar" position="104,30">lorem ipsum', |
| 472 |
|
'lorem ipsum</tw-passagedata></tw-storydata>', |
| 473 |
|
]; |
| 474 |
|
|
| 475 |
|
$textnode = new Textnode(); |
| 476 |
|
$textnode->setId('someTextnodeId'); |
| 477 |
|
|
| 478 |
|
$this->textnodeRepository->expects($this->any()) |
| 479 |
|
->method('find') |
| 480 |
|
->will($this->returnValue($textnode)); |
| 481 |
|
|
| 482 |
|
$this->textnodeRepository->expects($this->once()) |
| 483 |
|
->method('findByTwineId') |
| 484 |
|
->with($importfile, 'foobar') |
| 485 |
|
->willReturn($textnode); |
| 486 |
|
|
| 487 |
|
$this->importTwine->run($importfile); |
| 488 |
|
|
| 489 |
|
$this->assertTrue(self::$parserFreeCalled); |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
/** |
| 493 |
|
* tests disabling of a textnode that is no longer found in import file |