Code Duplication    Length = 26-26 lines in 2 locations

www/src/AdminBundle/Tests/Model/ImportTwineTest.php 2 locations

@@ 364-389 (lines=26) @@
361
     * @expectedException Exception
362
     * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
363
     */
364
    public function testRunWithTextnodeWithoutTwineID()
365
    {
366
        $importfile = $this->getDummyImportfile();
367
368
        $this->fileExtractorMock->expects(self::any())
369
            ->method('extract')
370
            ->willReturn('readable.extracted');
371
372
        self::$freadStack = [
373
            '<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",
374
            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
375
            '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum',
376
            'lorem ipsum</tw-passagedata></tw-storydata>',
377
        ];
378
379
        $textnode = new Textnode();
380
381
        $this->textnodeRepository->expects($this->any())
382
            ->method('find')
383
            ->will($this->returnValue($textnode));
384
385
        $this->textnodeRepository->expects($this->never())
386
            ->method('save');
387
388
        $this->importTwine->run($importfile);
389
    }
390
391
    /**
392
     * @expectedException Exception
@@ 395-420 (lines=26) @@
392
     * @expectedException Exception
393
     * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
394
     */
395
    public function testRunWithTextnodeWithoutAnyTag()
396
    {
397
        $importfile = $this->getDummyImportfile();
398
399
        $this->fileExtractorMock->expects(self::any())
400
            ->method('extract')
401
            ->willReturn('readable.extracted');
402
403
        self::$freadStack = [
404
            '<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",
405
            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
406
            '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum',
407
            'lorem ipsum</tw-passagedata></tw-storydata>',
408
        ];
409
410
        $textnode = new Textnode();
411
412
        $this->textnodeRepository->expects($this->any())
413
            ->method('find')
414
            ->will($this->returnValue($textnode));
415
416
        $this->textnodeRepository->expects($this->never())
417
            ->method('save');
418
419
        $this->importTwine->run($importfile);
420
    }
421
422
    /**
423
     * tests identifying a textnode by a twine ID