|
@@ 155-166 (lines=12) @@
|
| 152 |
|
/** |
| 153 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 154 |
|
*/ |
| 155 |
|
public function testEncryptWithKeyFileThrowsException() |
| 156 |
|
{ |
| 157 |
|
try { |
| 158 |
|
$this->encryption->expects($this->once()) |
| 159 |
|
->method('encryptFileWithKey') |
| 160 |
|
->will($this->throwException(new BaseCryptoException())); |
| 161 |
|
} catch (BaseCryptoException $e) { |
| 162 |
|
$this->throwException(new CryptoException()); |
| 163 |
|
} |
| 164 |
|
|
| 165 |
|
$this->wrapper->encryptFileWithKey(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
/** |
| 169 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
@@ 171-182 (lines=12) @@
|
| 168 |
|
/** |
| 169 |
|
* @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
| 170 |
|
*/ |
| 171 |
|
public function testDecryptWithKeyFileThrowsException() |
| 172 |
|
{ |
| 173 |
|
try { |
| 174 |
|
$this->encryption->expects($this->once()) |
| 175 |
|
->method('decryptFileWithKey') |
| 176 |
|
->will($this->throwException(new BaseCryptoException())); |
| 177 |
|
} catch (BaseCryptoException $e) { |
| 178 |
|
$this->throwException(new CryptoException()); |
| 179 |
|
} |
| 180 |
|
|
| 181 |
|
$this->wrapper->decryptFileWithKey(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
| 182 |
|
} |
| 183 |
|
} |
| 184 |
|
|