public function testOnBackupFinishedContinue() { $exception = $this->prophesize(\Exception::class); $event = $this->prophesize(BackupEvent::class); $event->getStatus()->willReturn(BackupStatus::STATE_FAILED); $event->getException()->willReturn($exception->reveal()); $this->environment->continueFailedBackup($exception->reveal())->shouldBeCalled()->willReturn(true); $event->cancel()->shouldNotBeCalled(); $this->listener->onBackupFinished($event->reveal()); }
/** * Asks environment (e.g. user over console) if he wants to continue failed backup. * * @param BackupEvent $event */ public function onBackupFinished(BackupEvent $event) { if ($event->getStatus() === BackupStatus::STATE_FAILED && !$this->environment->continueFailedBackup($event->getException())) { $event->cancel(); } }