Exemplo n.º 1
0
 /**
  * Asks environment (e.g. user over console) if he wants to restore partially backup.
  *
  * @param PreRestoreEvent $event
  */
 public function onPreRestore(PreRestoreEvent $event)
 {
     $systemDatabase = $event->getSystemDatabase();
     if ($systemDatabase->getWithDefault('state', BackupStatus::STATE_SUCCESS) === BackupStatus::STATE_PARTIALLY && !$this->environment->restorePartiallyBackup()) {
         $event->cancel();
     }
 }
Exemplo n.º 2
0
 public function testOnPreRestoreContinue()
 {
     $systemDatabase = $this->prophesize(ReadonlyDatabase::class);
     $event = $this->prophesize(PreRestoreEvent::class);
     $event->getSystemDatabase()->willReturn($systemDatabase->reveal());
     $systemDatabase->getWithDefault('state', BackupStatus::STATE_SUCCESS)->willReturn(BackupStatus::STATE_PARTIALLY);
     $this->environment->restorePartiallyBackup()->shouldBeCalled()->willReturn(true);
     $event->cancel()->shouldNotBeCalled();
     $this->listener->onPreRestore($event->reveal());
 }