Code Duplication    Length = 16-17 lines in 2 locations

src/Kunstmaan/MediaBundle/Tests/Helper/Transformer/PdfTransformerTest.php 2 locations

@@ 54-69 (lines=16) @@
51
    /**
52
     * @covers Kunstmaan\MediaBundle\Helper\Transformer\PdfTransformer::apply
53
     */
54
    public function testApplyWritesJpg()
55
    {
56
        $pdfFilename = $this->tempDir . '/sample.pdf';
57
        $jpgFilename = $pdfFilename.'.jpg';
58
59
        $pdf = $this->filesDir . '/sample.pdf';
60
        $this->filesystem->copy($pdf, $pdfFilename);
61
        $this->assertTrue(file_exists($pdfFilename));
62
63
        $transformer = new PdfTransformer(new \Imagick());
64
        $absolutePath = $transformer->apply($pdfFilename);
65
66
        $this->assertEquals($jpgFilename, $absolutePath);
67
        $this->assertTrue(file_exists($jpgFilename));
68
        $this->assertNotEmpty(file_get_contents($jpgFilename));
69
    }
70
71
    /**
72
     * @covers Kunstmaan\MediaBundle\Helper\Transformer\PdfTransformer::apply
@@ 74-90 (lines=17) @@
71
    /**
72
     * @covers Kunstmaan\MediaBundle\Helper\Transformer\PdfTransformer::apply
73
     */
74
    public function testApplyDoesNotOverwriteExisting()
75
    {
76
        $pdfFilename = $this->tempDir . '/sample.pdf';
77
        $jpgFilename = $pdfFilename . '.jpg';
78
79
        $pdf = $this->filesDir . '/sample.pdf';
80
        $this->filesystem->copy($pdf, $pdfFilename);
81
        $this->assertTrue(file_exists($pdfFilename));
82
83
        $this->filesystem->touch($jpgFilename);
84
85
        $transformer = new PdfTransformer(new \Imagick());
86
        $absolutePath = $transformer->apply($pdfFilename);
87
88
        $this->assertEquals($jpgFilename, $absolutePath);
89
        $this->assertEmpty(file_get_contents($jpgFilename));
90
    }
91
92
    /**
93
     * @covers Kunstmaan\MediaBundle\Helper\Transformer\PdfTransformer::getPreviewFilename