@@ 246-265 (lines=20) @@ | ||
243 | $this->registryWithEmptyConf->act($this->event2); |
|
244 | } |
|
245 | ||
246 | public function testActWithActionFailedException() |
|
247 | { |
|
248 | $this->registry->addAction('database', $this->action1, 1); |
|
249 | $this->registry->addAction('email', $this->action2, 2); |
|
250 | ||
251 | $this->logger->expects($this->once()) |
|
252 | ->method('error') |
|
253 | ->with('InformationCollection action database failed with reason cannot write to database'); |
|
254 | ||
255 | $exception = new ActionFailedException('database', 'cannot write to database'); |
|
256 | ||
257 | $this->action1->expects($this->once()) |
|
258 | ->method('act') |
|
259 | ->willThrowException($exception); |
|
260 | ||
261 | $this->action2->expects($this->never()) |
|
262 | ->method('act'); |
|
263 | ||
264 | $this->registry->act($this->event); |
|
265 | } |
|
266 | ||
267 | public function testActionsAreExecutedByPriority() |
|
268 | { |
|
@@ 389-409 (lines=21) @@ | ||
386 | * @expectedException \Netgen\Bundle\InformationCollectionBundle\Exception\ActionFailedException |
|
387 | * @expectedExceptionMessage InformationCollection action database failed with reason cannot write to database |
|
388 | */ |
|
389 | public function testThrowExceptionWhenDebugIsTrue() |
|
390 | { |
|
391 | $this->registry->addAction('database', $this->action1, 1); |
|
392 | $this->registry->addAction('email', $this->action2, 2); |
|
393 | ||
394 | $this->logger->expects($this->once()) |
|
395 | ->method('error') |
|
396 | ->with('InformationCollection action database failed with reason cannot write to database'); |
|
397 | ||
398 | $exception = new ActionFailedException('database', 'cannot write to database'); |
|
399 | ||
400 | $this->action1->expects($this->once()) |
|
401 | ->method('act') |
|
402 | ->willThrowException($exception); |
|
403 | ||
404 | $this->action2->expects($this->never()) |
|
405 | ->method('act'); |
|
406 | ||
407 | $this->registry->setDebug(true); |
|
408 | $this->registry->act($this->event); |
|
409 | } |
|
410 | ||
411 | public function testThrowExceptionWhenDebugIsFalse() |
|
412 | { |