Esempio n. 1
0
 public function decryption_throws_exception_if_creation_has_failed()
 {
     $called = false;
     Secret::setBacking(function ($value) {
         throw new XPException('Something went wrong - intentionally.');
     }, function ($value) {
         return null;
     });
     // Creation may never throw exception
     try {
         $s = new Secret('foo');
     } catch (\Throwable $t) {
         $this->fail('Exception thrown where no exception may be thrown', $t, null);
     }
     // Buf if creation failed, an exception must be raised here:
     $s->reveal();
 }