Completed
Push — master ( c93584...7286b1 )
by Francesco
04:37
created
Tests/EncryptionWrapperTest.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     public function testEncryptEncryptsPlaintext()
36 36
     {
37 37
         $this->encryption->expects($this->once())
38
-                         ->method('encrypt')
39
-                         ->with('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
40
-                         ->will($this->returnValue('ThisIsACipherText'));
38
+                            ->method('encrypt')
39
+                            ->with('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
40
+                            ->will($this->returnValue('ThisIsACipherText'));
41 41
 
42 42
         $ciphertext = $this->wrapper->encrypt('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'));
43 43
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
     {
52 52
         try {
53 53
             $this->encryption->expects($this->once())
54
-                             ->method('encrypt')
55
-                             ->with('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
56
-                             ->will($this->throwException(new EnvironmentIsBrokenException()));
54
+                                ->method('encrypt')
55
+                                ->with('The quick brown fox jumps over the lazy dog', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
56
+                                ->will($this->throwException(new EnvironmentIsBrokenException()));
57 57
         } catch (EnvironmentIsBrokenException $e) {
58 58
             $this->throwException(new CryptoException());
59 59
         }
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
     public function testDecryptDecryptsCiphertext()
65 65
     {
66 66
         $this->encryption->expects($this->once())
67
-                         ->method('decrypt')
68
-                         ->with('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
69
-                         ->will($this->returnValue('The quick brown fox jumps over the lazy dog'));
67
+                            ->method('decrypt')
68
+                            ->with('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
69
+                            ->will($this->returnValue('The quick brown fox jumps over the lazy dog'));
70 70
 
71 71
         $decryptedText = $this->wrapper->decrypt('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'));
72 72
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
     {
81 81
         try {
82 82
             $this->encryption->expects($this->once())
83
-                             ->method('decrypt')
84
-                             ->with('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
85
-                             ->will($this->throwException(new BaseCryptoException()));
83
+                                ->method('decrypt')
84
+                                ->with('ThisIsACipherText', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'))
85
+                                ->will($this->throwException(new BaseCryptoException()));
86 86
         } catch (BaseCryptoException $e) {
87 87
             $this->throwException(new CryptoException());
88 88
         }
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
     public function testEncryptFileEncryptsFile()
94 94
     {
95 95
         $this->encryption->expects($this->once())
96
-                         ->method('encryptFile')
97
-                         ->will($this->returnCallback(function ($input, $output) {
98
-                             $fs = new Filesystem();
99
-                             $fs->dumpFile($output, '');
100
-                         }));
96
+                            ->method('encryptFile')
97
+                            ->will($this->returnCallback(function ($input, $output) {
98
+                                $fs = new Filesystem();
99
+                                $fs->dumpFile($output, '');
100
+                            }));
101 101
 
102 102
         $this->wrapper->encryptFile(__DIR__.'/file.txt', __DIR__.'/file.crypto', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'));
103 103
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
     public function testDecryptFileDecryptsEncryptedFile()
110 110
     {
111 111
         $this->encryption->expects($this->once())
112
-                         ->method('decryptFile')
113
-                         ->will($this->returnCallback(function ($input, $output) {
114
-                             $fs = new Filesystem();
115
-                             $fs->dumpFile($output, 'Plain text');
116
-                         }));
112
+                            ->method('decryptFile')
113
+                            ->will($this->returnCallback(function ($input, $output) {
114
+                                $fs = new Filesystem();
115
+                                $fs->dumpFile($output, 'Plain text');
116
+                            }));
117 117
 
118 118
         $this->wrapper->decryptFile(__DIR__.'/file.crypto', __DIR__.'/file.txt', $this->getMock('Mes\Security\CryptoBundle\Model\KeyInterface'));
119 119
 
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
     {
131 131
         try {
132 132
             $this->encryption->expects($this->once())
133
-                             ->method('encryptFile')
134
-                             ->will($this->throwException(new BaseCryptoException()));
133
+                                ->method('encryptFile')
134
+                                ->will($this->throwException(new BaseCryptoException()));
135 135
         } catch (BaseCryptoException $e) {
136 136
             $this->throwException(new CryptoException());
137 137
         }
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
     {
147 147
         try {
148 148
             $this->encryption->expects($this->once())
149
-                             ->method('decryptFile')
150
-                             ->will($this->throwException(new BaseCryptoException()));
149
+                                ->method('decryptFile')
150
+                                ->will($this->throwException(new BaseCryptoException()));
151 151
         } catch (BaseCryptoException $e) {
152 152
             $this->throwException(new CryptoException());
153 153
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     protected function setUp()
159 159
     {
160 160
         $this->encryption = $this->getMockBuilder('Mes\Security\CryptoBundle\EncryptionInterface')
161
-                                 ->getMock();
161
+                                    ->getMock();
162 162
         $this->wrapper = new EncryptionWrapper($this->encryption);
163 163
     }
164 164
 
Please login to merge, or discard this patch.
Tests/DependencyInjection/MesCryptoExtensionTest.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         $this->assertHasDefinition('mes_crypto.raw_key');
33 33
         $this->assertSame('Defuse\Crypto\Key', $this->configuration->findDefinition('mes_crypto.raw_key')
34
-                                                                   ->getClass(), 'Defuse\Crypto\Key class is correct');
34
+                                                                    ->getClass(), 'Defuse\Crypto\Key class is correct');
35 35
 
36 36
         $this->assertNotHasDefinition('mes_crypto.crypto_loader');
37 37
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
         $this->assertHasDefinition('mes_crypto.raw_key');
46 46
         $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key')
47
-                                                                                      ->getClass(), 'KeyProtectedByPassword class is correct');
47
+                                                                                        ->getClass(), 'KeyProtectedByPassword class is correct');
48 48
 
49 49
         $this->assertNotHasDefinition('mes_crypto.crypto_loader');
50 50
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $this->assertHasDefinition('mes_crypto.raw_key');
59 59
         $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key')
60
-                                                                                      ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
60
+                                                                                        ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
61 61
         $this->assertNotHasDefinition('mes_crypto.crypto_loader');
62 62
     }
63 63
 
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 
70 70
         $this->assertHasDefinition('mes_crypto.raw_key');
71 71
         $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key')
72
-                                                                                      ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
72
+                                                                                        ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
73 73
         $this->assertHasDefinition('mes_crypto.crypto_loader');
74 74
 
75 75
         $keyResource = $this->configuration->findDefinition('mes_crypto.crypto_loader')
76
-                                           ->getArgument(0);
76
+                                            ->getArgument(0);
77 77
 
78 78
         $this->assertContains('key.crypto', $keyResource, sprintf('crypto file is %s', 'key.crypto'));
79 79
     }
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 
87 87
         $this->assertHasDefinition('mes_crypto.raw_key');
88 88
         $this->assertSame('Defuse\Crypto\KeyProtectedByPassword', $this->configuration->findDefinition('mes_crypto.raw_key')
89
-                                                                                      ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
89
+                                                                                        ->getClass(), 'Defuse\Crypto\KeyProtectedByPassword class is correct');
90 90
         $this->assertHasDefinition('mes_crypto.crypto_loader');
91 91
 
92 92
         $keyResource = $this->configuration->findDefinition('mes_crypto.crypto_loader')
93
-                                           ->getArgument(0);
93
+                                            ->getArgument(0);
94 94
 
95 95
         $this->assertContains('key.crypto', $keyResource, sprintf('crypto file is %s', 'key.crypto'));
96 96
 
Please login to merge, or discard this patch.