Example #1
0
 /**
  * Execute the syncs.
  *
  * @param  \phpbu\App\Configuration\Backup $backup
  * @param  \phpbu\App\Backup\Target        $target
  * @throws \Exception
  */
 protected function executeSyncs(Configuration\Backup $backup, Target $target)
 {
     /** @var \phpbu\App\Configuration\Backup\Sync $sync */
     foreach ($backup->getSyncs() as $sync) {
         try {
             $this->result->syncStart($sync);
             if ($this->failure && $sync->skipOnFailure) {
                 $this->result->syncSkipped($sync);
             } else {
                 $s = $this->factory->createSync($sync->type, $sync->options);
                 $s->sync($target, $this->result);
                 $this->result->syncEnd($sync);
             }
         } catch (Backup\Sync\Exception $e) {
             $this->failure = true;
             $this->result->addError($e);
             $this->result->syncFailed($sync);
         }
     }
 }
Example #2
0
 /**
  * Tests Factory::createCleaner
  *
  * @expectedException \phpbu\App\Exception
  */
 public function testCreateSyncThatIsNone()
 {
     Factory::register('sync', 'nothing', '\\phpbu\\App\\phpbuAppFactoryTestNothing', true);
     $factory = new Factory();
     $factory->createSync('nothing');
     $this->assertFalse(true, 'Exception should be thrown');
 }