Code Duplication    Length = 20-23 lines in 2 locations

tests/Unit/FileStorageTest.php 2 locations

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