Completed
Pull Request — master (#14)
by Dan
03:24
created
Tests/Cache/CachePrivateTest.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * Test that array has keys.
38 38
      */
39
-    public function testArrayHasKeys(){
39
+    public function testArrayHasKeys() {
40 40
         $data = ['a' => 'foo', 'b' => 'bar'];
41 41
         $method = $this->getCacheMethod('_hasKeys');
42 42
         $actual = $method->invokeArgs($this->cache, [$data]);
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * Test exception thrown when array is missing keys.
48 48
      */
49
-    public function testArrayHasNoKeys(){
49
+    public function testArrayHasNoKeys() {
50 50
         $this->expectException(InvalidArgumentException::class);
51
-        $data = ['foo','bar'];
51
+        $data = ['foo', 'bar'];
52 52
         $method = $this->getCacheMethod('_hasKeys');
53 53
         $method->invokeArgs($this->cache, [$data]);
54 54
     }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * Test array contains a failure.
58 58
      */
59
-    public function testHasFailure(){
60
-        $results = [true,true,true,false,true];
59
+    public function testHasFailure() {
60
+        $results = [true, true, true, false, true];
61 61
         $method = $this->getCacheMethod('_hasFailure');
62 62
         $actual = $method->invokeArgs($this->cache, [$results]);
63 63
         $expected = true;
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
     /**
68 68
      *
69 69
      */
70
-    public function testHasNoFailure(){
71
-        $results = [true,true,true,true,true];
70
+    public function testHasNoFailure() {
71
+        $results = [true, true, true, true, true];
72 72
         $method = $this->getCacheMethod('_hasFailure');
73 73
         $actual = $method->invokeArgs($this->cache, [$results]);
74 74
         $expected = false;
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
     /**
79 79
      * Test that array is Traversable
80 80
      */
81
-    public function testIsTraversable(){
82
-        $data = ['a','b','c','d'];
81
+    public function testIsTraversable() {
82
+        $data = ['a', 'b', 'c', 'd'];
83 83
         $method = $this->getCacheMethod('_isTraversable');
84 84
         $actual = $method->invokeArgs($this->cache, [$data]);
85 85
         $expected = true;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     /**
90 90
      * Test that string is not Traversable
91 91
      */
92
-    public function testIsNotTraversable(){
92
+    public function testIsNotTraversable() {
93 93
         $this->expectException(InvalidArgumentException::class);
94 94
         $data = 'some-random-string';
95 95
         $method = $this->getCacheMethod('_isTraversable');
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     /**
100 100
      * Test that instance of Iterator is traversable
101 101
      */
102
-    public function testIsTraversableIterator(){
102
+    public function testIsTraversableIterator() {
103 103
         $iterator = new IteratorMock();
104 104
         $method = $this->getCacheMethod('_isTraversable');
105 105
         $actual = $method->invokeArgs($this->cache, [$iterator]);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param $method
113 113
      * @return \ReflectionMethod
114 114
      */
115
-    private function getCacheMethod($method){
115
+    private function getCacheMethod($method) {
116 116
         $reflector = new \ReflectionClass('\Ds\Cache\Cache');
117 117
         $method = $reflector->getMethod($method);
118 118
         $method->setAccessible(true);
Please login to merge, or discard this patch.
Tests/Cache/CacheTest.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     {
40 40
         $key = 21021000;
41 41
         $this->expectException(InvalidArgumentException::class);
42
-        $this->cache->set($key,'value');
42
+        $this->cache->set($key, 'value');
43 43
     }
44 44
 
45 45
     /**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     /**
206 206
      *
207 207
      */
208
-    public function testGetMultiple(){
208
+    public function testGetMultiple() {
209 209
 
210 210
         $expected = [
211 211
             'foo' => 'fooValue',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         $i = 0;
217 217
 
218
-        foreach ($expected as $key => $value){
218
+        foreach ($expected as $key => $value) {
219 219
 
220 220
             $this->storageMock->expects($this->at($i))
221 221
                 ->method('get')
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     /**
236 236
      *
237 237
      */
238
-    public function testSetMultiple(){
238
+    public function testSetMultiple() {
239 239
 
240 240
         $keys = [
241 241
             'foo' => 'fooValue',
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $i = 0;
250 250
         $expires = 60 * 60;
251 251
 
252
-        foreach ($keys as $key => $value){
252
+        foreach ($keys as $key => $value) {
253 253
             $this->storageMock->expects($this->at($i))
254 254
                 ->method('set')
255 255
                 ->with(
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
             $i++;
262 262
         }
263 263
 
264
-        $actual = $this->cache->setMultiple($keys,$expires);
264
+        $actual = $this->cache->setMultiple($keys, $expires);
265 265
         $this->assertEquals($expected, $actual);
266 266
     }
267 267
 
268 268
     /**
269 269
      *
270 270
      */
271
-    public function testSetMultipleWithFailure(){
271
+    public function testSetMultipleWithFailure() {
272 272
 
273 273
         $keys = [
274 274
             'foo' => 'fooValue',
@@ -282,11 +282,11 @@  discard block
 block discarded – undo
282 282
         $i = 0;
283 283
         $expires = 60 * 60;
284 284
 
285
-        foreach ($keys as $key => $value){
285
+        foreach ($keys as $key => $value) {
286 286
 
287 287
             $status = $addStatus;
288 288
 
289
-            if ($i === 1){
289
+            if ($i === 1) {
290 290
                 $status = false;
291 291
             }
292 292
 
@@ -301,20 +301,20 @@  discard block
 block discarded – undo
301 301
             $i++;
302 302
         }
303 303
 
304
-        $actual = $this->cache->setMultiple($keys,$expires);
304
+        $actual = $this->cache->setMultiple($keys, $expires);
305 305
         $this->assertEquals($expected, $actual);
306 306
     }
307 307
 
308 308
     /**
309 309
      *
310 310
      */
311
-    public function testDeleteMultiple(){
311
+    public function testDeleteMultiple() {
312 312
 
313
-        $keys = ['foo','bar','baz'];
313
+        $keys = ['foo', 'bar', 'baz'];
314 314
         $deleteStatus = true;
315 315
         $expected = true;
316 316
 
317
-        foreach ($keys as $i => $key){
317
+        foreach ($keys as $i => $key) {
318 318
             $this->storageMock->expects($this->at($i))
319 319
                 ->method('delete')
320 320
                 ->with(
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
     /**
331 331
      *
332 332
      */
333
-    public function testDeleteMultipleFailure(){
334
-        $keys = ['foo','bar','baz'];
333
+    public function testDeleteMultipleFailure() {
334
+        $keys = ['foo', 'bar', 'baz'];
335 335
         $expected = false;
336 336
         $deleteStatus = true;
337
-        foreach ($keys as $i => $key){
338
-            if ($i === 1){
337
+        foreach ($keys as $i => $key) {
338
+            if ($i === 1) {
339 339
                 $deleteStatus = false;
340 340
             }
341 341
             $this->storageMock->expects($this->at($i))
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     /**
353 353
      * Test that storage clear is called.
354 354
      */
355
-    public function testclear(){
355
+    public function testclear() {
356 356
         $this->storageMock
357 357
             ->expects($this->once())
358 358
             ->method('clear');
Please login to merge, or discard this patch.