@@ 236-246 (lines=11) @@ | ||
233 | /** |
|
234 | * Tests setting delete. |
|
235 | */ |
|
236 | public function testDelete() |
|
237 | { |
|
238 | $setting = new Setting(); |
|
239 | $setting->setId('acme'); |
|
240 | $setting->setName('acme'); |
|
241 | ||
242 | $this->repository->expects($this->once()) |
|
243 | ->method('findOneBy')->with($this->equalTo(['name' => 'acme']))->willReturn($setting); |
|
244 | $manager = new SettingsManager( |
|
245 | $this->repository, |
|
246 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
247 | ); |
|
248 | ||
249 | $manager->delete('acme'); |
|
@@ 252-264 (lines=13) @@ | ||
249 | $manager->delete('acme'); |
|
250 | } |
|
251 | ||
252 | public function testHas() |
|
253 | { |
|
254 | $setting = new Setting(); |
|
255 | $setting->setName('acme'); |
|
256 | $setting->setValue('foo'); |
|
257 | ||
258 | $this->repository->expects($this->once()) |
|
259 | ->method('findOneBy')->with($this->equalTo(['name' => 'acme']))->willReturn($setting); |
|
260 | $manager = new SettingsManager( |
|
261 | $this->repository, |
|
262 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
263 | ); |
|
264 | ||
265 | $result = $manager->has('acme'); |
|
266 | ||
267 | $this->assertTrue($result); |
|
@@ 290-301 (lines=12) @@ | ||
287 | /** |
|
288 | * Tests setting update. |
|
289 | */ |
|
290 | public function testGetValue() |
|
291 | { |
|
292 | $setting = new Setting(); |
|
293 | $setting->setName('acme'); |
|
294 | $setting->setValue('foo'); |
|
295 | ||
296 | $this->repository->expects($this->once())->method('findOneBy')->willReturn($setting); |
|
297 | $manager = new SettingsManager( |
|
298 | $this->repository, |
|
299 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
300 | ); |
|
301 | ||
302 | $result = $manager->getValue('acme'); |
|
303 | $this->assertEquals('foo', $result); |
|
304 | } |