@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | protected function setUp() |
| 37 | 37 | { |
| 38 | 38 | $this->encryption = $this->getMockBuilder('Mes\Security\CryptoBundle\EncryptionInterface') |
| 39 | - ->getMock(); |
|
| 39 | + ->getMock(); |
|
| 40 | 40 | $this->wrapper = new EncryptionWrapper($this->encryption); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | public function testEncryptWithKeyEncryptsPlaintext() |
| 60 | 60 | { |
| 61 | 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') |
|
| 62 | + ->method('encryptWithKey') |
|
| 63 | + ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 64 | 64 | ->getMock()) |
| 65 | - ->will($this->returnValue('ThisIsACipherText')); |
|
| 65 | + ->will($this->returnValue('ThisIsACipherText')); |
|
| 66 | 66 | |
| 67 | 67 | $ciphertext = $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 68 | - ->getMock()); |
|
| 68 | + ->getMock()); |
|
| 69 | 69 | |
| 70 | 70 | $this->assertTrue(ctype_print($ciphertext), 'is printable'); |
| 71 | 71 | } |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | { |
| 78 | 78 | try { |
| 79 | 79 | $this->encryption->expects($this->once()) |
| 80 | - ->method('encryptWithKey') |
|
| 81 | - ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 80 | + ->method('encryptWithKey') |
|
| 81 | + ->with('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 82 | 82 | ->getMock()) |
| 83 | - ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 83 | + ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 84 | 84 | } catch (EnvironmentIsBrokenException $e) { |
| 85 | 85 | $this->throwException(new CryptoException()); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $this->wrapper->encryptWithKey('The quick brown fox jumps over the lazy dog', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 89 | - ->getMock()); |
|
| 89 | + ->getMock()); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | public function testDecryptWithKeyDecryptsCiphertext() |
| 96 | 96 | { |
| 97 | 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')); |
|
| 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 | 102 | |
| 103 | 103 | $decryptedText = $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 104 | - ->getMock()); |
|
| 104 | + ->getMock()); |
|
| 105 | 105 | |
| 106 | 106 | $this->assertSame('The quick brown fox jumps over the lazy dog', $decryptedText); |
| 107 | 107 | } |
@@ -113,16 +113,16 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | try { |
| 115 | 115 | $this->encryption->expects($this->once()) |
| 116 | - ->method('decryptWithKey') |
|
| 117 | - ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 118 | - ->getMock()) |
|
| 119 | - ->will($this->throwException(new BaseCryptoException())); |
|
| 116 | + ->method('decryptWithKey') |
|
| 117 | + ->with('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 118 | + ->getMock()) |
|
| 119 | + ->will($this->throwException(new BaseCryptoException())); |
|
| 120 | 120 | } catch (BaseCryptoException $e) { |
| 121 | 121 | $this->throwException(new CryptoException()); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $this->wrapper->decryptWithKey('ThisIsACipherText', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 125 | - ->getMock()); |
|
| 125 | + ->getMock()); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /* ======================================= |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | public function testEncryptFileWithKeyEncryptsFile() |
| 139 | 139 | { |
| 140 | 140 | $this->encryption->expects($this->once()) |
| 141 | - ->method('encryptFileWithKey') |
|
| 142 | - ->will($this->returnCallback(function ($input, $output) { |
|
| 143 | - $fs = new Filesystem(); |
|
| 144 | - $fs->dumpFile($output, ''); |
|
| 145 | - })); |
|
| 141 | + ->method('encryptFileWithKey') |
|
| 142 | + ->will($this->returnCallback(function ($input, $output) { |
|
| 143 | + $fs = new Filesystem(); |
|
| 144 | + $fs->dumpFile($output, ''); |
|
| 145 | + })); |
|
| 146 | 146 | |
| 147 | 147 | $this->wrapper->encryptFileWithKey(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 148 | - ->getMock()); |
|
| 148 | + ->getMock()); |
|
| 149 | 149 | |
| 150 | 150 | $this->assertFileExists(__DIR__.'/file.crypto'); |
| 151 | 151 | |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | public function testDecryptFileWithKeyDecryptsEncryptedFile() |
| 159 | 159 | { |
| 160 | 160 | $this->encryption->expects($this->once()) |
| 161 | - ->method('decryptFileWithKey') |
|
| 162 | - ->will($this->returnCallback(function ($input, $output) { |
|
| 163 | - $fs = new Filesystem(); |
|
| 164 | - $fs->dumpFile($output, 'Plain text'); |
|
| 165 | - })); |
|
| 161 | + ->method('decryptFileWithKey') |
|
| 162 | + ->will($this->returnCallback(function ($input, $output) { |
|
| 163 | + $fs = new Filesystem(); |
|
| 164 | + $fs->dumpFile($output, 'Plain text'); |
|
| 165 | + })); |
|
| 166 | 166 | |
| 167 | 167 | $this->wrapper->decryptFileWithKey(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 168 | - ->getMock()); |
|
| 168 | + ->getMock()); |
|
| 169 | 169 | |
| 170 | 170 | $this->assertFileExists(__DIR__.'/file.txt'); |
| 171 | 171 | $this->assertContains('Plain text', file_get_contents(__DIR__.'/file.txt')); |
@@ -180,14 +180,14 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | try { |
| 182 | 182 | $this->encryption->expects($this->once()) |
| 183 | - ->method('encryptFileWithKey') |
|
| 184 | - ->will($this->throwException(new BaseCryptoException())); |
|
| 183 | + ->method('encryptFileWithKey') |
|
| 184 | + ->will($this->throwException(new BaseCryptoException())); |
|
| 185 | 185 | } catch (BaseCryptoException $e) { |
| 186 | 186 | $this->throwException(new CryptoException()); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $this->wrapper->encryptFileWithKey(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 190 | - ->getMock()); |
|
| 190 | + ->getMock()); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | try { |
| 199 | 199 | $this->encryption->expects($this->once()) |
| 200 | - ->method('decryptFileWithKey') |
|
| 201 | - ->will($this->throwException(new BaseCryptoException())); |
|
| 200 | + ->method('decryptFileWithKey') |
|
| 201 | + ->will($this->throwException(new BaseCryptoException())); |
|
| 202 | 202 | } catch (BaseCryptoException $e) { |
| 203 | 203 | $this->throwException(new CryptoException()); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | $this->wrapper->decryptFileWithKey(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 207 | - ->getMock()); |
|
| 207 | + ->getMock()); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /* ======================================== |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | public function testEncryptWithPasswordEncryptsPlaintext() |
| 218 | 218 | { |
| 219 | 219 | $this->encryption->expects($this->once()) |
| 220 | - ->method('encryptWithPassword') |
|
| 221 | - ->with('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word') |
|
| 222 | - ->will($this->returnValue('ThisIsACipherText')); |
|
| 220 | + ->method('encryptWithPassword') |
|
| 221 | + ->with('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word') |
|
| 222 | + ->will($this->returnValue('ThisIsACipherText')); |
|
| 223 | 223 | |
| 224 | 224 | $ciphertext = $this->wrapper->encryptWithPassword('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word'); |
| 225 | 225 | |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | try { |
| 235 | 235 | $this->encryption->expects($this->once()) |
| 236 | - ->method('encryptWithPassword') |
|
| 237 | - ->with('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word') |
|
| 238 | - ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 236 | + ->method('encryptWithPassword') |
|
| 237 | + ->with('The quick brown fox jumps over the lazy dog', 'SuperSecretPa$$word') |
|
| 238 | + ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 239 | 239 | } catch (EnvironmentIsBrokenException $e) { |
| 240 | 240 | $this->throwException(new CryptoException()); |
| 241 | 241 | } |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | public function testDecryptWithPasswordDecryptsCiphertext() |
| 247 | 247 | { |
| 248 | 248 | $this->encryption->expects($this->once()) |
| 249 | - ->method('decryptWithPassword') |
|
| 250 | - ->with('ThisIsACipherText', 'SuperSecretPa$$word') |
|
| 251 | - ->will($this->returnValue('The quick brown fox jumps over the lazy dog')); |
|
| 249 | + ->method('decryptWithPassword') |
|
| 250 | + ->with('ThisIsACipherText', 'SuperSecretPa$$word') |
|
| 251 | + ->will($this->returnValue('The quick brown fox jumps over the lazy dog')); |
|
| 252 | 252 | |
| 253 | 253 | $decryptedText = $this->wrapper->decryptWithPassword('ThisIsACipherText', 'SuperSecretPa$$word'); |
| 254 | 254 | |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | { |
| 263 | 263 | try { |
| 264 | 264 | $this->encryption->expects($this->once()) |
| 265 | - ->method('decryptWithPassword') |
|
| 266 | - ->with('ThisIsACipherText', 'SuperSecretPa$$word') |
|
| 267 | - ->will($this->throwException(new WrongKeyOrModifiedCiphertextException())); |
|
| 265 | + ->method('decryptWithPassword') |
|
| 266 | + ->with('ThisIsACipherText', 'SuperSecretPa$$word') |
|
| 267 | + ->will($this->throwException(new WrongKeyOrModifiedCiphertextException())); |
|
| 268 | 268 | } catch (BaseCryptoException $e) { |
| 269 | 269 | $this->throwException(new CryptoException()); |
| 270 | 270 | } |
@@ -282,11 +282,11 @@ discard block |
||
| 282 | 282 | public function testEncryptFileWithPasswordEncryptsFile() |
| 283 | 283 | { |
| 284 | 284 | $this->encryption->expects($this->once()) |
| 285 | - ->method('encryptFileWithPassword') |
|
| 286 | - ->will($this->returnCallback(function ($input, $output, $password) { |
|
| 287 | - $fs = new Filesystem(); |
|
| 288 | - $fs->dumpFile($output, ''); |
|
| 289 | - })); |
|
| 285 | + ->method('encryptFileWithPassword') |
|
| 286 | + ->will($this->returnCallback(function ($input, $output, $password) { |
|
| 287 | + $fs = new Filesystem(); |
|
| 288 | + $fs->dumpFile($output, ''); |
|
| 289 | + })); |
|
| 290 | 290 | |
| 291 | 291 | $this->wrapper->encryptFileWithPassword(__DIR__.'/file.txt', __DIR__.'/file.crypto', 'SuperSecretPa$$word'); |
| 292 | 292 | |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | try { |
| 304 | 304 | $this->encryption->expects($this->once()) |
| 305 | - ->method('encryptFileWithPassword') |
|
| 306 | - ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 305 | + ->method('encryptFileWithPassword') |
|
| 306 | + ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 307 | 307 | } catch (EnvironmentIsBrokenException $e) { |
| 308 | 308 | $this->throwException(new CryptoException()); |
| 309 | 309 | } |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | public function testDecryptFileWithPasswordDecryptsEncryptedFile() |
| 315 | 315 | { |
| 316 | 316 | $this->encryption->expects($this->once()) |
| 317 | - ->method('decryptFileWithPassword') |
|
| 318 | - ->will($this->returnCallback(function ($input, $output, $password) { |
|
| 319 | - $fs = new Filesystem(); |
|
| 320 | - $fs->dumpFile($output, 'Plain text'); |
|
| 321 | - })); |
|
| 317 | + ->method('decryptFileWithPassword') |
|
| 318 | + ->will($this->returnCallback(function ($input, $output, $password) { |
|
| 319 | + $fs = new Filesystem(); |
|
| 320 | + $fs->dumpFile($output, 'Plain text'); |
|
| 321 | + })); |
|
| 322 | 322 | |
| 323 | 323 | $this->wrapper->decryptFileWithPassword(__DIR__.'/file.crypto', __DIR__.'/file.txt', 'SuperSecretPa$$word'); |
| 324 | 324 | |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | { |
| 336 | 336 | try { |
| 337 | 337 | $this->encryption->expects($this->once()) |
| 338 | - ->method('decryptFileWithPassword') |
|
| 339 | - ->will($this->throwException(new WrongKeyOrModifiedCiphertextException())); |
|
| 338 | + ->method('decryptFileWithPassword') |
|
| 339 | + ->will($this->throwException(new WrongKeyOrModifiedCiphertextException())); |
|
| 340 | 340 | } catch (BaseCryptoException $e) { |
| 341 | 341 | $this->throwException(new CryptoException()); |
| 342 | 342 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | protected function setUp() |
| 37 | 37 | { |
| 38 | 38 | $this->keyStorage = $this->getMockBuilder('Mes\Security\CryptoBundle\KeyStorage\KeyStorageInterface') |
| 39 | - ->getMock(); |
|
| 39 | + ->getMock(); |
|
| 40 | 40 | |
| 41 | 41 | $this->keyGenerator = $this->getMockBuilder('Mes\Security\CryptoBundle\KeyGenerator\KeyGeneratorInterface') |
| 42 | - ->getMock(); |
|
| 42 | + ->getMock(); |
|
| 43 | 43 | |
| 44 | 44 | $this->keyManager = new KeyManager($this->keyStorage, $this->keyGenerator); |
| 45 | 45 | } |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | public function testGenerateCreatesKey() |
| 55 | 55 | { |
| 56 | 56 | $this->keyGenerator->expects($this->once()) |
| 57 | - ->method('generate') |
|
| 58 | - ->with(null) |
|
| 59 | - ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 57 | + ->method('generate') |
|
| 58 | + ->with(null) |
|
| 59 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 60 | 60 | |
| 61 | 61 | $key = $this->keyManager->generate(); |
| 62 | 62 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | $secret = 'ThisIsASecretPassword'; |
| 70 | 70 | |
| 71 | 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())); |
|
| 72 | + ->method('generateFromAscii') |
|
| 73 | + ->with($key_encoded, $secret) |
|
| 74 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 75 | 75 | |
| 76 | 76 | $key = $this->keyManager->generateFromAscii($key_encoded, $secret); |
| 77 | 77 | |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | public function testGetKeyReadsNotExistingKey() |
| 82 | 82 | { |
| 83 | 83 | $this->keyStorage->expects($this->once()) |
| 84 | - ->method('getKey') |
|
| 85 | - ->will($this->returnValue(null)); |
|
| 84 | + ->method('getKey') |
|
| 85 | + ->will($this->returnValue(null)); |
|
| 86 | 86 | |
| 87 | 87 | $this->keyGenerator->expects($this->once()) |
| 88 | - ->method('generate') |
|
| 89 | - ->with(null) |
|
| 90 | - ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 91 | - ->getMock())); |
|
| 88 | + ->method('generate') |
|
| 89 | + ->with(null) |
|
| 90 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 91 | + ->getMock())); |
|
| 92 | 92 | |
| 93 | 93 | $this->keyStorage->expects($this->once()) |
| 94 | - ->method('setKey'); |
|
| 94 | + ->method('setKey'); |
|
| 95 | 95 | |
| 96 | 96 | $key = $this->keyManager->getKey(); |
| 97 | 97 | |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | public function testGetKeyReadsExistingKey() |
| 102 | 102 | { |
| 103 | 103 | $this->keyStorage->expects($this->never()) |
| 104 | - ->method('setKey'); |
|
| 104 | + ->method('setKey'); |
|
| 105 | 105 | |
| 106 | 106 | $this->keyGenerator->expects($this->never()) |
| 107 | - ->method('generate'); |
|
| 107 | + ->method('generate'); |
|
| 108 | 108 | |
| 109 | 109 | $this->keyStorage->expects($this->once()) |
| 110 | - ->method('getKey') |
|
| 111 | - ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 110 | + ->method('getKey') |
|
| 111 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 112 | 112 | ->getMock())); |
| 113 | 113 | |
| 114 | 114 | $key = $this->keyManager->getKey(); |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | public function testSetKeyStoresKey() |
| 120 | 120 | { |
| 121 | 121 | $this->keyStorage->expects($this->once()) |
| 122 | - ->method('setKey') |
|
| 123 | - ->with($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 124 | - ->getMock()); |
|
| 122 | + ->method('setKey') |
|
| 123 | + ->with($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
|
| 124 | + ->getMock()); |
|
| 125 | 125 | |
| 126 | 126 | $this->keyManager->setKey($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
| 127 | - ->getMock()); |
|
| 127 | + ->getMock()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public function testSetSecretStoreSecret() |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | protected function setUp() |
| 37 | 37 | { |
| 38 | 38 | $this->keyManager = $this->getMockBuilder('\Mes\Security\CryptoBundle\KeyManagerInterface') |
| 39 | - ->getMock(); |
|
| 39 | + ->getMock(); |
|
| 40 | 40 | $this->wrapper = new KeyManagerWrapper($this->keyManager); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | public function testGenerateCreatesKey() |
| 49 | 49 | { |
| 50 | 50 | $this->keyManager->expects($this->once()) |
| 51 | - ->method('generate') |
|
| 52 | - ->with(null) |
|
| 53 | - ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 51 | + ->method('generate') |
|
| 52 | + ->with(null) |
|
| 53 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 54 | 54 | |
| 55 | 55 | $key = $this->wrapper->generate(); |
| 56 | 56 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | try { |
| 66 | 66 | $this->keyManager->expects($this->once()) |
| 67 | - ->method('generate') |
|
| 68 | - ->with(null) |
|
| 69 | - ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 67 | + ->method('generate') |
|
| 68 | + ->with(null) |
|
| 69 | + ->will($this->throwException(new EnvironmentIsBrokenException())); |
|
| 70 | 70 | } catch (EnvironmentIsBrokenException $ex) { |
| 71 | 71 | $this->throwException(new CryptoException()); |
| 72 | 72 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | $secret = 'ThisIsASecretPassword'; |
| 81 | 81 | |
| 82 | 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())); |
|
| 83 | + ->method('generateFromAscii') |
|
| 84 | + ->with($key_encoded, $secret) |
|
| 85 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 86 | 86 | |
| 87 | 87 | $key = $this->wrapper->generateFromAscii($key_encoded, $secret); |
| 88 | 88 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | try { |
| 101 | 101 | $this->keyManager->expects($this->once()) |
| 102 | - ->method('generateFromAscii') |
|
| 103 | - ->with($key_encoded, $secret) |
|
| 104 | - ->will($this->throwException(new BaseCryptoException())); |
|
| 102 | + ->method('generateFromAscii') |
|
| 103 | + ->with($key_encoded, $secret) |
|
| 104 | + ->will($this->throwException(new BaseCryptoException())); |
|
| 105 | 105 | } catch (CryptoException $ex) { |
| 106 | 106 | $this->throwException(new CryptoException()); |
| 107 | 107 | } |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | public function testGetKeyReadsKey() |
| 113 | 113 | { |
| 114 | 114 | $this->keyManager->expects($this->once()) |
| 115 | - ->method('getKey') |
|
| 116 | - ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 115 | + ->method('getKey') |
|
| 116 | + ->will($this->returnValue($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock())); |
|
| 117 | 117 | |
| 118 | 118 | $key = $this->wrapper->getKey(); |
| 119 | 119 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | public function testSetKeyStoresKey() |
| 124 | 124 | { |
| 125 | 125 | $this->keyManager->expects($this->once()) |
| 126 | - ->method('setKey') |
|
| 127 | - ->with($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
| 126 | + ->method('setKey') |
|
| 127 | + ->with($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
|
| 128 | 128 | |
| 129 | 129 | $this->wrapper->setKey($this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface')->getMock()); |
| 130 | 130 | } |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | public function testSetSecretStoresSecret() |
| 133 | 133 | { |
| 134 | 134 | $this->keyManager->expects($this->once()) |
| 135 | - ->method('setSecret') |
|
| 136 | - ->with('ThisIsASecret'); |
|
| 135 | + ->method('setSecret') |
|
| 136 | + ->with('ThisIsASecret'); |
|
| 137 | 137 | |
| 138 | 138 | $this->wrapper->setSecret('ThisIsASecret'); |
| 139 | 139 | } |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | public function testGetSecretReadsSecret() |
| 142 | 142 | { |
| 143 | 143 | $this->keyManager->expects($this->once()) |
| 144 | - ->method('getSecret') |
|
| 145 | - ->will($this->returnValue('ThisIsYourSecret')); |
|
| 144 | + ->method('getSecret') |
|
| 145 | + ->will($this->returnValue('ThisIsYourSecret')); |
|
| 146 | 146 | |
| 147 | 147 | $secret = $this->wrapper->getSecret(); |
| 148 | 148 | |