@@ 229-239 (lines=11) @@ | ||
226 | * @expectedException \LogicException |
|
227 | * @expectedExceptionMessage Setting acme not exist. |
|
228 | */ |
|
229 | public function testUpdateWhenSettingNotExists() |
|
230 | { |
|
231 | $this->repository->expects($this->once())->method('findOneBy')->willReturn(null); |
|
232 | ||
233 | $manager = new SettingsManager( |
|
234 | $this->repository, |
|
235 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
236 | ); |
|
237 | $manager->setCache($this->cache); |
|
238 | $manager->update('acme', ['value' => 'foo']); |
|
239 | } |
|
240 | ||
241 | /** |
|
242 | * Tests setting delete. |
|
@@ 282-294 (lines=13) @@ | ||
279 | /** |
|
280 | * Test has method when there is no setting. |
|
281 | */ |
|
282 | public function testHasWhenThereIsNoSetting() |
|
283 | { |
|
284 | $this->repository->expects($this->once()) |
|
285 | ->method('findOneBy')->with($this->equalTo(['name.name' => 'acme']))->willReturn(null); |
|
286 | $manager = new SettingsManager( |
|
287 | $this->repository, |
|
288 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
289 | ); |
|
290 | ||
291 | $result = $manager->has('acme'); |
|
292 | ||
293 | $this->assertFalse($result); |
|
294 | } |
|
295 | ||
296 | /** |
|
297 | * Tests setting update. |
|
@@ 318-328 (lines=11) @@ | ||
315 | /** |
|
316 | * Tests setting update. |
|
317 | */ |
|
318 | public function testGetValueWhenThereIsNoSetting() |
|
319 | { |
|
320 | $this->repository->expects($this->once())->method('findOneBy')->willReturn(null); |
|
321 | $manager = new SettingsManager( |
|
322 | $this->repository, |
|
323 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
324 | ); |
|
325 | ||
326 | $result = $manager->getValue('acme', 'bar'); |
|
327 | $this->assertEquals('bar', $result); |
|
328 | } |
|
329 | ||
330 | /** |
|
331 | * Returns document iterator with pre-loaded aggregations. |