@@ 239-258 (lines=20) @@ | ||
236 | $this->registryWithEmptyConf->act($this->event2); |
|
237 | } |
|
238 | ||
239 | public function testActWithActionFailedException() |
|
240 | { |
|
241 | $this->registry->addAction('database', $this->action1, 1); |
|
242 | $this->registry->addAction('email', $this->action2, 2); |
|
243 | ||
244 | $this->logger->expects($this->once()) |
|
245 | ->method('error') |
|
246 | ->with('InformationCollection action database failed with reason cannot write to database'); |
|
247 | ||
248 | $exception = new ActionFailedException('database', 'cannot write to database'); |
|
249 | ||
250 | $this->action1->expects($this->once()) |
|
251 | ->method('act') |
|
252 | ->willThrowException($exception); |
|
253 | ||
254 | $this->action2->expects($this->never()) |
|
255 | ->method('act'); |
|
256 | ||
257 | $this->registry->act($this->event); |
|
258 | } |
|
259 | ||
260 | public function testActionsAreExecutedByPriority() |
|
261 | { |
|
@@ 383-403 (lines=21) @@ | ||
380 | * @expectedExceptionMessage InformationCollection action database failed with reason cannot write to database |
|
381 | ||
382 | */ |
|
383 | public function testThrowExceptionWhenDebugIsTrue() |
|
384 | { |
|
385 | $this->registry->addAction('database', $this->action1, 1); |
|
386 | $this->registry->addAction('email', $this->action2, 2); |
|
387 | ||
388 | $this->logger->expects($this->once()) |
|
389 | ->method('error') |
|
390 | ->with('InformationCollection action database failed with reason cannot write to database'); |
|
391 | ||
392 | $exception = new ActionFailedException('database', 'cannot write to database'); |
|
393 | ||
394 | $this->action1->expects($this->once()) |
|
395 | ->method('act') |
|
396 | ->willThrowException($exception); |
|
397 | ||
398 | $this->action2->expects($this->never()) |
|
399 | ->method('act'); |
|
400 | ||
401 | $this->registry->setDebug(true); |
|
402 | $this->registry->act($this->event); |
|
403 | } |
|
404 | } |
|
405 |