@@ 67-79 (lines=13) @@ | ||
64 | /** |
|
65 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
66 | */ |
|
67 | public function testEncryptWithKeyEncryptsPlaintextThrowsException() |
|
68 | { |
|
69 | try { |
|
70 | $this->encryption->expects($this->once()) |
|
71 | ->method('encryptWithKey') |
|
72 | ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()) |
|
73 | ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
74 | } catch (EnvironmentIsBrokenException $e) { |
|
75 | $this->throwException(new CryptoException()); |
|
76 | } |
|
77 | ||
78 | $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
79 | } |
|
80 | ||
81 | /** |
|
82 | * @throws \Mes\Security\CryptoBundle\Exception\CryptoException |
|
@@ 99-111 (lines=13) @@ | ||
96 | /** |
|
97 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
98 | */ |
|
99 | public function testDecryptWithKeyDecryptsCiphertextThrowsException() |
|
100 | { |
|
101 | try { |
|
102 | $this->encryption->expects($this->once()) |
|
103 | ->method('decryptWithKey') |
|
104 | ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()) |
|
105 | ->will($this->throwException(new BaseCryptoException())); |
|
106 | } catch (BaseCryptoException $e) { |
|
107 | $this->throwException(new CryptoException()); |
|
108 | } |
|
109 | ||
110 | $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * @throws \Mes\Security\CryptoBundle\Exception\CryptoException |