Code Duplication    Length = 20-23 lines in 2 locations

tests/Unit/FileStorageTest.php 2 locations

@@ 84-103 (lines=20) @@
81
        $storage->create(new Message('key', 'domain', 'en', 'Message'));
82
    }
83
84
    public function testCreateExistingCatalogue()
85
    {
86
        $writer = $this->getMockBuilder(TranslationWriter::class)
87
            ->setMethods(['writeTranslations'])
88
            ->disableOriginalConstructor()
89
            ->getMock();
90
        $writer->expects($this->once())
91
            ->method('writeTranslations')
92
            ->with(
93
                $this->isInstanceOf(MessageCatalogueInterface::class),
94
                'xlf',
95
                ['path' => $this->getFixturePath(), 'xliff_version' => '2.0']
96
            );
97
98
        $loader = $this->createTranslationLoader();
99
        $loader->addLoader('xlf', new XliffLoader());
100
        $storage = new FileStorage($writer, $loader, ['foo', $this->getFixturePath()]);
101
102
        $storage->create(new Message('key', 'messages', 'en', 'Translation'));
103
    }
104
105
    public function testGet()
106
    {
@@ 149-171 (lines=23) @@
146
        $storage->update(new Message('test_1', 'messages', 'en', 'Translation'));
147
    }
148
149
    public function testDelete()
150
    {
151
        $writer = $this->getMockBuilder(TranslationWriter::class)
152
            ->setMethods(['writeTranslations'])
153
            ->disableOriginalConstructor()
154
            ->getMock();
155
156
        $writer->expects($this->once())
157
            ->method('writeTranslations')
158
            ->with(
159
                $this->callback(function (MessageCatalogueInterface $catalogue) {
160
                    return !$catalogue->defines('test_0', 'messages');
161
                }),
162
                'xlf',
163
                ['path' => $this->getFixturePath(), 'xliff_version' => '2.0']
164
            );
165
166
        $loader = $this->createTranslationLoader();
167
        $loader->addLoader('xlf', new XliffLoader());
168
        $storage = new FileStorage($writer, $loader, [$this->getFixturePath()]);
169
170
        $storage->delete('en', 'messages', 'test_0');
171
    }
172
173
    public function testImport()
174
    {