Code Duplication    Length = 26-26 lines in 2 locations

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

@@ 338-363 (lines=26) @@
335
     * @expectedException Exception
336
     * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
337
     */
338
    public function testRunWithTextnodeWithoutTwineID()
339
    {
340
        $importfile = $this->getDummyImportfile();
341
342
        $this->fileExtractorMock->expects(self::any())
343
            ->method('extract')
344
            ->willReturn('readable.extracted');
345
346
        self::$freadStack = [
347
            '<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",
348
            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
349
            '<tw-passagedata pid="1" name="someNodeName1" tags="Freigegeben" position="104,30">lorem ipsum',
350
            'lorem ipsum</tw-passagedata></tw-storydata>',
351
        ];
352
353
        $textnode = new Textnode();
354
355
        $this->textnodeRepository->expects($this->any())
356
            ->method('find')
357
            ->will($this->returnValue($textnode));
358
359
        $this->textnodeRepository->expects($this->never())
360
            ->method('save');
361
362
        $this->importTwine->run($importfile);
363
    }
364
365
    /**
366
     * @expectedException Exception
@@ 369-394 (lines=26) @@
366
     * @expectedException Exception
367
     * @expectedExceptionMessage no ID given for Textnode "someNodeName1"
368
     */
369
    public function testRunWithTextnodeWithoutAnyTag()
370
    {
371
        $importfile = $this->getDummyImportfile();
372
373
        $this->fileExtractorMock->expects(self::any())
374
            ->method('extract')
375
            ->willReturn('readable.extracted');
376
377
        self::$freadStack = [
378
            '<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",
379
            '<script role="script" id="twine-user-script" type="text/twine-javascript"></script>'."\n",
380
            '<tw-passagedata pid="1" name="someNodeName1" tags="" position="104,30">lorem ipsum',
381
            'lorem ipsum</tw-passagedata></tw-storydata>',
382
        ];
383
384
        $textnode = new Textnode();
385
386
        $this->textnodeRepository->expects($this->any())
387
            ->method('find')
388
            ->will($this->returnValue($textnode));
389
390
        $this->textnodeRepository->expects($this->never())
391
            ->method('save');
392
393
        $this->importTwine->run($importfile);
394
    }
395
396
    /**
397
     * tests identifying a textnode by a twine ID