|
@@ 203-213 (lines=11) @@
|
| 200 |
|
/** |
| 201 |
|
* Tests setting delete. |
| 202 |
|
*/ |
| 203 |
|
public function testDelete() |
| 204 |
|
{ |
| 205 |
|
$setting = new Setting(); |
| 206 |
|
$setting->setId('acme'); |
| 207 |
|
$setting->setName('acme'); |
| 208 |
|
|
| 209 |
|
$this->repository->expects($this->once())->method('findOneBy')->with($this->equalTo(['name' => 'acme']))->willReturn($setting); |
| 210 |
|
$manager = new SettingsManager($this->repository, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); |
| 211 |
|
|
| 212 |
|
$manager->delete('acme'); |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
public function testHas() |
| 216 |
|
{ |
|
@@ 215-227 (lines=13) @@
|
| 212 |
|
$manager->delete('acme'); |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
public function testHas() |
| 216 |
|
{ |
| 217 |
|
$setting = new Setting(); |
| 218 |
|
$setting->setName('acme'); |
| 219 |
|
$setting->setValue('foo'); |
| 220 |
|
|
| 221 |
|
$this->repository->expects($this->once())->method('findOneBy')->with($this->equalTo(['name' => 'acme']))->willReturn($setting); |
| 222 |
|
$manager = new SettingsManager($this->repository, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); |
| 223 |
|
|
| 224 |
|
$result = $manager->has('acme'); |
| 225 |
|
|
| 226 |
|
$this->assertTrue($result); |
| 227 |
|
} |
| 228 |
|
|
| 229 |
|
/** |
| 230 |
|
* Test has method when there is no setting. |
|
@@ 245-256 (lines=12) @@
|
| 242 |
|
/** |
| 243 |
|
* Tests setting update. |
| 244 |
|
*/ |
| 245 |
|
public function testGetValue() |
| 246 |
|
{ |
| 247 |
|
$setting = new Setting(); |
| 248 |
|
$setting->setName('acme'); |
| 249 |
|
$setting->setValue('foo'); |
| 250 |
|
|
| 251 |
|
$this->repository->expects($this->once())->method('findOneBy')->willReturn($setting); |
| 252 |
|
$manager = new SettingsManager($this->repository, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')); |
| 253 |
|
|
| 254 |
|
$result = $manager->getValue('acme'); |
| 255 |
|
$this->assertEquals('foo', $result); |
| 256 |
|
} |
| 257 |
|
|
| 258 |
|
/** |
| 259 |
|
* Tests setting update. |