Esempio n. 1
0
 /**
  * Execute encryption.
  *
  * @param \phpbu\App\Configuration\Backup $backup
  * @param \phpbu\App\Backup\Target        $target
  */
 protected function executeCrypt(Configuration\Backup $backup, Target $target)
 {
     $crypt = $backup->getCrypt();
     if (!empty($crypt)) {
         try {
             $this->result->cryptStart($crypt);
             if ($this->failure && $crypt->skipOnFailure) {
                 $this->result->cryptSkipped($crypt);
             } else {
                 $c = $this->factory->createCrypter($crypt->type, $crypt->options);
                 $c->crypt($target, $this->result);
                 $target->setCrypter($c);
             }
         } catch (Backup\Crypter\Exception $e) {
             $this->failure = true;
             $this->result->addError($e);
             $this->result->cryptFailed($crypt);
         }
     }
 }
Esempio n. 2
0
 /**
  * Tests Factory::createSource
  *
  * @expectedException \phpbu\App\Exception
  */
 public function testCreateCrypterThatIsNone()
 {
     Factory::register('crypter', 'nothing', '\\phpbu\\App\\phpbuAppFactoryTestNothing', true);
     $factory = new Factory();
     $factory->createCrypter('nothing');
     $this->assertFalse(true, 'Exception should be thrown');
 }