Completed
Push — master ( 90d111...2a2a91 )
by Владислав
02:09
created
tests/DeCaptchaAbstractTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function testGetBaseUrl()
20 20
     {
21 21
         $abstract = $this->newInstance();
22
-        $getBaseUrlCaller = function () {
22
+        $getBaseUrlCaller = function() {
23 23
             return $this->getBaseUrl();
24 24
         };
25 25
         $abstract->domain = 'domain';
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $abstract = $this->newInstance();
33 33
         $abstract->setApiKey('123456val');
34
-        $apiKeyValCaller = function () {
34
+        $apiKeyValCaller = function() {
35 35
             return $this->apiKey;
36 36
         };
37 37
         $bound = $apiKeyValCaller->bindTo($abstract, $abstract);
38 38
         $this->assertEquals('123456val', $bound());
39 39
 
40
-        $abstract->setApiKey(function () {
41
-            return '123456'.'fun';
40
+        $abstract->setApiKey(function() {
41
+            return '123456' . 'fun';
42 42
         });
43
-        $apiKeyFunCaller = function () {
43
+        $apiKeyFunCaller = function() {
44 44
             return $this->apiKey;
45 45
         };
46 46
         $bound = $apiKeyFunCaller->bindTo($abstract, $abstract);
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
     public function testGetActionUrl()
51 51
     {
52 52
         $abstract = $this->newInstance();
53
-        $getBaseUrlGetCodeCaller = function () {
53
+        $getBaseUrlGetCodeCaller = function() {
54 54
             $this->captchaId = 123;
55 55
 
56 56
             return $this->getActionUrl('get_code');
57 57
         };
58
-        $getBaseUrlGetBalanceCaller = function () {
58
+        $getBaseUrlGetBalanceCaller = function() {
59 59
             $this->captchaId = 234;
60 60
 
61 61
             return $this->getActionUrl('get_balance');
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     public function testGetFilePath()
72 72
     {
73 73
         $abstract = $this->newInstance();
74
-        $getFilePathCaller = function ($val) {
74
+        $getFilePathCaller = function($val) {
75 75
             return $this->getFilePath($val);
76 76
         };
77 77
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
78
-        $this->assertEquals(__DIR__.'/data/Captcha.jpg', $bound(__DIR__.'/data/Captcha.jpg'));
78
+        $this->assertEquals(__DIR__ . '/data/Captcha.jpg', $bound(__DIR__ . '/data/Captcha.jpg'));
79 79
         $filePathUpload = $bound('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg');
80
-        $file1 = file_get_contents(__DIR__.'/data/Captcha.jpg');
80
+        $file1 = file_get_contents(__DIR__ . '/data/Captcha.jpg');
81 81
         $file2 = file_get_contents($filePathUpload);
82 82
         $this->assertEquals($file1, $file2);
83 83
     }
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
     public function testGetFilePathErrorFileNotFound()
90 90
     {
91 91
         $abstract = $this->newInstance();
92
-        $getFilePathCaller = function ($val) {
92
+        $getFilePathCaller = function($val) {
93 93
             return $this->getFilePath($val);
94 94
         };
95 95
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
96
-        $bound(__DIR__.'/data/Captcha1.jpg');
96
+        $bound(__DIR__ . '/data/Captcha1.jpg');
97 97
     }
98 98
 
99 99
     /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     public function testGetFilePathErrorFileIsNotLoaded()
105 105
     {
106 106
         $abstract = $this->newInstance();
107
-        $getFilePathCaller = function ($val) {
107
+        $getFilePathCaller = function($val) {
108 108
             return $this->getFilePath($val);
109 109
         };
110 110
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     public function testGetFilePathErrorFileIsNotWriteAccessFile()
120 120
     {
121 121
         $abstract = $this->newInstance();
122
-        $getFilePathCaller = function ($val) {
122
+        $getFilePathCaller = function($val) {
123 123
             return $this->getFilePath($val);
124 124
         };
125 125
         $bound = $getFilePathCaller->bindTo($abstract, $abstract);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $abstract = $this->newInstance();
134 134
         $abstract->domain = 'echo.jsontest.com/aaa/bbb';
135
-        $getResponseCaller = function ($val) {
135
+        $getResponseCaller = function($val) {
136 136
             return $this->getResponse($val);
137 137
         };
138 138
         $bound = $getResponseCaller->bindTo($abstract, $abstract);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     public function testExecutionDelayed()
144 144
     {
145 145
         $abstract = $this->newInstance();
146
-        $executionDelayedCaller = function ($second, $call = null) {
146
+        $executionDelayedCaller = function($second, $call = null) {
147 147
             return $this->executionDelayed($second, $call);
148 148
         };
149 149
         $bound = $executionDelayedCaller->bindTo($abstract, $abstract);
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $this->assertTrue(abs($timePassed - 0.1) < 0.035);
155 155
 
156 156
         $start = microtime(true);
157
-        $bound(0.15, function () {
157
+        $bound(0.15, function() {
158 158
             sleep(0.2);
159 159
         });
160 160
         $bound(0.1);
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
         $this->assertTrue(abs($timePassed - 0.25) < 0.035);
163 163
 
164 164
         $start = microtime(true);
165
-        $bound(0.15, function () {
165
+        $bound(0.15, function() {
166 166
             sleep(0.2);
167 167
         });
168 168
         $bound(0.3);
169 169
         $timePassed = microtime(true) - $start;
170 170
         $this->assertTrue(abs($timePassed - 0.45) < 0.035);
171 171
 
172
-        $this->assertEquals(2, $bound(0, function () {
172
+        $this->assertEquals(2, $bound(0, function() {
173 173
             return 2;
174 174
         }));
175 175
         $this->assertEquals(null, $bound(0));
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function testGetInUrl()
179 179
     {
180 180
         $abstract = $this->newInstance();
181
-        $getInUrlCaller = function () {
181
+        $getInUrlCaller = function() {
182 182
             return $this->getInUrl();
183 183
         };
184 184
         $abstract->domain = 'domain';
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     public function testIsError()
195 195
     {
196 196
         $abstract = $this->newInstance();
197
-        $isErrorCaller = function ($val) {
197
+        $isErrorCaller = function($val) {
198 198
             return $this->isError($val);
199 199
         };
200 200
         $bound = $isErrorCaller->bindTo($abstract, $abstract);
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     public function testIsErrorNot()
205 205
     {
206 206
         $abstract = $this->newInstance();
207
-        $isErrorCaller = function ($val) {
207
+        $isErrorCaller = function($val) {
208 208
             return $this->isError($val);
209 209
         };
210 210
         $bound = $isErrorCaller->bindTo($abstract, $abstract);
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $abstract = $this->newInstance();
222 222
         $abstract->domain = 'domain';
223
-        $getCurlResponseCaller = function ($val) {
223
+        $getCurlResponseCaller = function($val) {
224 224
             return $this->getCurlResponse($val);
225 225
         };
226 226
         $bound = $getCurlResponseCaller->bindTo($abstract, $abstract);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     {
232 232
         $abstract = $this->newInstance();
233 233
         $abstract->domain = 'httpbin.org';
234
-        $getCurlResponseCaller = function ($val) {
234
+        $getCurlResponseCaller = function($val) {
235 235
             $this->inUrl = 'post';
236 236
 
237 237
             return $this->getCurlResponse($val);
Please login to merge, or discard this patch.