@@ 74-93 (lines=20) @@ | ||
71 | $storage->create(new Message('key', 'domain', 'en', 'Message')); |
|
72 | } |
|
73 | ||
74 | public function testCreateExistingCatalogue() |
|
75 | { |
|
76 | $writer = $this->getMockBuilder(TranslationWriter::class) |
|
77 | ->setMethods([$this->getMethodNameToWriteTranslations()]) |
|
78 | ->disableOriginalConstructor() |
|
79 | ->getMock(); |
|
80 | $writer->expects($this->once()) |
|
81 | ->method($this->getMethodNameToWriteTranslations()) |
|
82 | ->with( |
|
83 | $this->isInstanceOf(MessageCatalogueInterface::class), |
|
84 | 'xlf', |
|
85 | ['path' => $this->getFixturePath(), 'xliff_version' => '2.0'] |
|
86 | ); |
|
87 | ||
88 | $loader = $this->createTranslationLoader(); |
|
89 | $loader->addLoader('xlf', new XliffFileLoader()); |
|
90 | $storage = new FileStorage($writer, $loader, ['foo', $this->getFixturePath()]); |
|
91 | ||
92 | $storage->create(new Message('key', 'messages', 'en', 'Translation')); |
|
93 | } |
|
94 | ||
95 | public function testGet() |
|
96 | { |
|
@@ 139-161 (lines=23) @@ | ||
136 | $storage->update(new Message('test_1', 'messages', 'en', 'Translation')); |
|
137 | } |
|
138 | ||
139 | public function testDelete() |
|
140 | { |
|
141 | $writer = $this->getMockBuilder(TranslationWriter::class) |
|
142 | ->setMethods([$this->getMethodNameToWriteTranslations()]) |
|
143 | ->disableOriginalConstructor() |
|
144 | ->getMock(); |
|
145 | ||
146 | $writer->expects($this->once()) |
|
147 | ->method($this->getMethodNameToWriteTranslations()) |
|
148 | ->with( |
|
149 | $this->callback(function (MessageCatalogueInterface $catalogue) { |
|
150 | return !$catalogue->defines('test_0', 'messages'); |
|
151 | }), |
|
152 | 'xlf', |
|
153 | ['path' => $this->getFixturePath(), 'xliff_version' => '2.0'] |
|
154 | ); |
|
155 | ||
156 | $loader = $this->createTranslationLoader(); |
|
157 | $loader->addLoader('xlf', new XliffFileLoader()); |
|
158 | $storage = new FileStorage($writer, $loader, [$this->getFixturePath()]); |
|
159 | ||
160 | $storage->delete('en', 'messages', 'test_0'); |
|
161 | } |
|
162 | ||
163 | public function testImport() |
|
164 | { |