@@ 52-62 (lines=11) @@ | ||
49 | /** |
|
50 | * @throws \Mes\Security\CryptoBundle\Exception\CryptoException |
|
51 | */ |
|
52 | public function testEncryptWithKeyEncryptsPlaintext() |
|
53 | { |
|
54 | $this->encryption->expects($this->once()) |
|
55 | ->method('encryptWithKey') |
|
56 | ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()) |
|
57 | ->will($this->returnValue('ThisIsACipherText')); |
|
58 | ||
59 | $ciphertext = $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
60 | ||
61 | $this->assertTrue(ctype_print($ciphertext), 'is printable'); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
@@ 84-94 (lines=11) @@ | ||
81 | /** |
|
82 | * @throws \Mes\Security\CryptoBundle\Exception\CryptoException |
|
83 | */ |
|
84 | public function testDecryptWithKeyDecryptsCiphertext() |
|
85 | { |
|
86 | $this->encryption->expects($this->once()) |
|
87 | ->method('decryptWithKey') |
|
88 | ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()) |
|
89 | ->will($this->returnValue('The quick brown fox jumps over the lazy dog')); |
|
90 | ||
91 | $decryptedText = $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
92 | ||
93 | $this->assertSame('The quick brown fox jumps over the lazy dog', $decryptedText); |
|
94 | } |
|
95 | ||
96 | /** |
|
97 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |