|
@@ 129-140 (lines=12) @@
|
| 126 |
|
/** |
| 127 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 128 |
|
*/ |
| 129 |
|
public function testEncryptFileThrowsException() |
| 130 |
|
{ |
| 131 |
|
try { |
| 132 |
|
$this->encryption->expects($this->once()) |
| 133 |
|
->method('encryptFile') |
| 134 |
|
->will($this->throwException(new BaseCryptoException())); |
| 135 |
|
} catch (BaseCryptoException $e) { |
| 136 |
|
$this->throwException(new CryptoException()); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
$this->wrapper->encryptFile(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
| 140 |
|
} |
| 141 |
|
|
| 142 |
|
/** |
| 143 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
@@ 145-156 (lines=12) @@
|
| 142 |
|
/** |
| 143 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 144 |
|
*/ |
| 145 |
|
public function testDecryptFileThrowsException() |
| 146 |
|
{ |
| 147 |
|
try { |
| 148 |
|
$this->encryption->expects($this->once()) |
| 149 |
|
->method('decryptFile') |
| 150 |
|
->will($this->throwException(new BaseCryptoException())); |
| 151 |
|
} catch (BaseCryptoException $e) { |
| 152 |
|
$this->throwException(new CryptoException()); |
| 153 |
|
} |
| 154 |
|
|
| 155 |
|
$this->wrapper->decryptFile(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface')); |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
protected function setUp() |
| 159 |
|
{ |