@@ -9,7 +9,7 @@ |
||
9 | 9 | * file that was distributed with this source code. |
10 | 10 | */ |
11 | 11 | |
12 | -register_shutdown_function(function () { |
|
12 | +register_shutdown_function(function() { |
|
13 | 13 | if (file_exists(__DIR__.'/key.crypto')) { |
14 | 14 | unlink(__DIR__.'/key.crypto'); |
15 | 15 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | protected function setUp() |
34 | 34 | { |
35 | 35 | $this->encryption = $this->getMockBuilder('Mes\Security\CryptoBundle\EncryptionInterface') |
36 | - ->getMock(); |
|
36 | + ->getMock(); |
|
37 | 37 | $this->wrapper = new EncryptionWrapper($this->encryption); |
38 | 38 | } |
39 | 39 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function testEncryptResourceWithKeyEncryptsHandle() |
57 | 57 | { |
58 | 58 | $this->encryption->expects($this->once()) |
59 | - ->method('encryptResourceWithKey'); |
|
59 | + ->method('encryptResourceWithKey'); |
|
60 | 60 | |
61 | 61 | $this->wrapper->encryptResourceWithKey(fopen('php://stdin', 'r'), fopen('php://memory', 'wb'), $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
62 | 62 | ->getMock()); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function testDecryptResourceWithKeyDecryptsEncryptedHandle() |
69 | 69 | { |
70 | 70 | $this->encryption->expects($this->once()) |
71 | - ->method('decryptResourceWithKey'); |
|
71 | + ->method('decryptResourceWithKey'); |
|
72 | 72 | |
73 | 73 | $this->wrapper->decryptResourceWithKey(fopen('php://stdin', 'r'), fopen('php://memory', 'wb'), $this->getMockBuilder('Mes\Security\CryptoBundle\Model\KeyInterface') |
74 | 74 | ->getMock()); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | { |
82 | 82 | try { |
83 | 83 | $this->encryption->expects($this->once()) |
84 | - ->method('encryptResourceWithKey') |
|
85 | - ->will($this->throwException(new BaseCryptoException())); |
|
84 | + ->method('encryptResourceWithKey') |
|
85 | + ->will($this->throwException(new BaseCryptoException())); |
|
86 | 86 | } catch (BaseCryptoException $e) { |
87 | 87 | $this->throwException(new CryptoException()); |
88 | 88 | } |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | { |
99 | 99 | try { |
100 | 100 | $this->encryption->expects($this->once()) |
101 | - ->method('decryptResourceWithKey') |
|
102 | - ->will($this->throwException(new BaseCryptoException())); |
|
101 | + ->method('decryptResourceWithKey') |
|
102 | + ->will($this->throwException(new BaseCryptoException())); |
|
103 | 103 | } catch (BaseCryptoException $e) { |
104 | 104 | $this->throwException(new CryptoException()); |
105 | 105 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | public function testEncryptResourceWithPasswordEncryptsHandle() |
122 | 122 | { |
123 | 123 | $this->encryption->expects($this->once()) |
124 | - ->method('encryptResourceWithPassword'); |
|
124 | + ->method('encryptResourceWithPassword'); |
|
125 | 125 | |
126 | 126 | $this->wrapper->encryptResourceWithPassword(fopen('php://stdin', 'r'), fopen('php://memory', 'wb'), 'SecretPa$$word'); |
127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function testDecryptResourceWithPasswordDecryptsEncryptedHandle() |
133 | 133 | { |
134 | 134 | $this->encryption->expects($this->once()) |
135 | - ->method('decryptResourceWithPassword'); |
|
135 | + ->method('decryptResourceWithPassword'); |
|
136 | 136 | |
137 | 137 | $this->wrapper->decryptResourceWithPassword(fopen('php://stdin', 'r'), fopen('php://memory', 'wb'), 'SecretPa$$word'); |
138 | 138 | } |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | { |
145 | 145 | try { |
146 | 146 | $this->encryption->expects($this->once()) |
147 | - ->method('encryptResourceWithPassword') |
|
148 | - ->will($this->throwException(new BaseCryptoException())); |
|
147 | + ->method('encryptResourceWithPassword') |
|
148 | + ->will($this->throwException(new BaseCryptoException())); |
|
149 | 149 | } catch (BaseCryptoException $e) { |
150 | 150 | $this->throwException(new CryptoException()); |
151 | 151 | } |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | { |
161 | 161 | try { |
162 | 162 | $this->encryption->expects($this->once()) |
163 | - ->method('decryptResourceWithPassword') |
|
164 | - ->will($this->throwException(new BaseCryptoException())); |
|
163 | + ->method('decryptResourceWithPassword') |
|
164 | + ->will($this->throwException(new BaseCryptoException())); |
|
165 | 165 | } catch (BaseCryptoException $e) { |
166 | 166 | $this->throwException(new CryptoException()); |
167 | 167 | } |
@@ -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 |