| @@ 244-259 (lines=16) @@ | ||
| 241 | /** |
|
| 242 | * Tests setting delete. |
|
| 243 | */ |
|
| 244 | public function testDelete() |
|
| 245 | { |
|
| 246 | $setting = new Setting(); |
|
| 247 | $setting->setId('acme'); |
|
| 248 | $setting->setName('acme'); |
|
| 249 | ||
| 250 | $this->repository->expects($this->any()) |
|
| 251 | ->method('findOneBy')->with($this->equalTo(['name.name' => 'acme']))->willReturn($setting); |
|
| 252 | $manager = new SettingsManager( |
|
| 253 | $this->repository, |
|
| 254 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
| 255 | ); |
|
| 256 | $manager->setCache($this->cache); |
|
| 257 | ||
| 258 | $manager->delete('acme'); |
|
| 259 | } |
|
| 260 | ||
| 261 | public function testHas() |
|
| 262 | { |
|
| @@ 261-273 (lines=13) @@ | ||
| 258 | $manager->delete('acme'); |
|
| 259 | } |
|
| 260 | ||
| 261 | public function testHas() |
|
| 262 | { |
|
| 263 | $setting = new Setting(); |
|
| 264 | $setting->setName('acme'); |
|
| 265 | $setting->setValue('foo'); |
|
| 266 | ||
| 267 | $this->repository->expects($this->once()) |
|
| 268 | ->method('findOneBy')->with($this->equalTo(['name.name' => 'acme']))->willReturn($setting); |
|
| 269 | $manager = new SettingsManager( |
|
| 270 | $this->repository, |
|
| 271 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
| 272 | ); |
|
| 273 | ||
| 274 | $result = $manager->has('acme'); |
|
| 275 | ||
| 276 | $this->assertTrue($result); |
|
| @@ 299-310 (lines=12) @@ | ||
| 296 | /** |
|
| 297 | * Tests setting update. |
|
| 298 | */ |
|
| 299 | public function testGetValue() |
|
| 300 | { |
|
| 301 | $setting = new Setting(); |
|
| 302 | $setting->setName('acme'); |
|
| 303 | $setting->setValue('foo'); |
|
| 304 | ||
| 305 | $this->repository->expects($this->once())->method('findOneBy')->willReturn($setting); |
|
| 306 | $manager = new SettingsManager( |
|
| 307 | $this->repository, |
|
| 308 | $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface') |
|
| 309 | ); |
|
| 310 | ||
| 311 | $result = $manager->getValue('acme'); |
|
| 312 | $this->assertEquals('foo', $result); |
|
| 313 | } |
|