@@ 59-69 (lines=11) @@ | ||
56 | /** |
|
57 | * @throws CryptoException |
|
58 | */ |
|
59 | public function testEncryptWithKeyEncryptsPlaintext() |
|
60 | { |
|
61 | $this->encryption->expects($this->once()) |
|
62 | ->method('encryptWithKey') |
|
63 | ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
64 | ->getMock()) |
|
65 | ->will($this->returnValue('ThisIsACipherText')); |
|
66 | ||
67 | $ciphertext = $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
68 | ->getMock()); |
|
69 | ||
70 | $this->assertTrue(ctype_print($ciphertext), 'is printable'); |
|
71 | } |
|
72 | ||
@@ 95-105 (lines=11) @@ | ||
92 | /** |
|
93 | * @throws CryptoException |
|
94 | */ |
|
95 | public function testDecryptWithKeyDecryptsCiphertext() |
|
96 | { |
|
97 | $this->encryption->expects($this->once()) |
|
98 | ->method('decryptWithKey') |
|
99 | ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
100 | ->getMock()) |
|
101 | ->will($this->returnValue('The quick brown fox jumps over the lazy dog')); |
|
102 | ||
103 | $decryptedText = $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
104 | ->getMock()); |
|
105 | ||
106 | $this->assertSame('The quick brown fox jumps over the lazy dog', $decryptedText); |
|
107 | } |
|
108 |