| @@ 54-65 (lines=12) @@ | ||
| 51 | $this->keyManager = null; |
|
| 52 | } |
|
| 53 | ||
| 54 | public function testGenerateCreatesKey() |
|
| 55 | { |
|
| 56 | $this->keyGenerator->expects($this->once()) |
|
| 57 | ->method('generate') |
|
| 58 | ->with(null) |
|
| 59 | ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 60 | ||
| 61 | $key = $this->keyManager->generate(); |
|
| 62 | ||
| 63 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testGeneratedFromAsciiCreatesKeyFromAscii() |
|
| 67 | { |
|
| 68 | $key_encoded = 'key_encoded'; |
|
| @@ 48-59 (lines=12) @@ | ||
| 45 | $this->wrapper = null; |
|
| 46 | } |
|
| 47 | ||
| 48 | public function testGenerateCreatesKey() |
|
| 49 | { |
|
| 50 | $this->keyManager->expects($this->once()) |
|
| 51 | ->method('generate') |
|
| 52 | ->with(null) |
|
| 53 | ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 54 | ||
| 55 | $key = $this->wrapper->generate(); |
|
| 56 | ||
| 57 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
| 62 | */ |
|
| @@ 112-122 (lines=11) @@ | ||
| 109 | $this->wrapper->generateFromAscii($key_encoded, $secret); |
|
| 110 | } |
|
| 111 | ||
| 112 | public function testGetKeyReadsKey() |
|
| 113 | { |
|
| 114 | $this->keyManager->expects($this->once()) |
|
| 115 | ->method('getKey') |
|
| 116 | ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 117 | ||
| 118 | $key = $this->wrapper->getKey(); |
|
| 119 | ||
| 120 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 121 | } |
|
| 122 | ||
| 123 | public function testSetKeyStoresKey() |
|
| 124 | { |
|
| 125 | $this->keyManager->expects($this->once()) |
|