| @@ 66-80 (lines=15) @@ | ||
| 63 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testGeneratedFromAsciiCreatesKeyFromAscii() |
|
| 67 | { |
|
| 68 | $key_encoded = 'key_encoded'; |
|
| 69 | $secret = 'ThisIsASecretPassword'; |
|
| 70 | ||
| 71 | $this->keyGenerator->expects($this->once()) |
|
| 72 | ->method('generateFromAscii') |
|
| 73 | ->with($key_encoded, $secret) |
|
| 74 | ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 75 | ||
| 76 | $key = $this->keyManager->generateFromAscii($key_encoded, $secret); |
|
| 77 | ||
| 78 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 79 | } |
|
| 80 | ||
| 81 | public function testGetKeyReadsNotExistingKey() |
|
| 82 | { |
|
| 83 | $this->keyStorage->expects($this->once()) |
|
| @@ 77-91 (lines=15) @@ | ||
| 74 | $this->wrapper->generate(); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testGenerateFromAsciiCreatesKeyFromAscii() |
|
| 78 | { |
|
| 79 | $key_encoded = 'key_encoded'; |
|
| 80 | $secret = 'ThisIsASecretPassword'; |
|
| 81 | ||
| 82 | $this->keyManager->expects($this->once()) |
|
| 83 | ->method('generateFromAscii') |
|
| 84 | ->with($key_encoded, $secret) |
|
| 85 | ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 86 | ||
| 87 | $key = $this->wrapper->generateFromAscii($key_encoded, $secret); |
|
| 88 | ||
| 89 | $this->assertInstanceOf('Mes\Security\CryptoBundle\Model\KeyInterface', $key); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @expectedException \Mes\Security\CryptoBundle\Exception\CryptoException |
|
| 94 | */ |
|