|
@@ 50-62 (lines=13) @@
|
| 47 |
|
/** |
| 48 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 49 |
|
*/ |
| 50 |
|
public function testEncryptEncryptsPlaintextThrowsException() |
| 51 |
|
{ |
| 52 |
|
try { |
| 53 |
|
$this->encryption->expects($this->once()) |
| 54 |
|
->method('encrypt') |
| 55 |
|
->with('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')) |
| 56 |
|
->will($this->throwException(new EnvironmentIsBrokenException())); |
| 57 |
|
} catch (EnvironmentIsBrokenException $e) { |
| 58 |
|
$this->throwException(new CryptoException()); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
$this->wrapper->encrypt('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
public function testDecryptDecryptsCiphertext() |
| 65 |
|
{ |
|
@@ 79-91 (lines=13) @@
|
| 76 |
|
/** |
| 77 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 78 |
|
*/ |
| 79 |
|
public function testDecryptDecryptsCiphertextThrowsException() |
| 80 |
|
{ |
| 81 |
|
try { |
| 82 |
|
$this->encryption->expects($this->once()) |
| 83 |
|
->method('decrypt') |
| 84 |
|
->with('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')) |
| 85 |
|
->will($this->throwException(new BaseCryptoException())); |
| 86 |
|
} catch (BaseCryptoException $e) { |
| 87 |
|
$this->throwException(new CryptoException()); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
$this->wrapper->decrypt('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
public function testEncryptFileEncryptsFile() |
| 94 |
|
{ |