Completed
Push — master ( 4c07ef...756562 )
by Dan
06:35 queued 03:19
created
Tests/Cache/CacheTest.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Ds\Cache\Cache;
6 6
 use Ds\Cache\CacheStorageInterface;
7
-use Ds\Cache\NullStorage;
8 7
 use Psr\SimpleCache\InvalidArgumentException;
9 8
 
10 9
 /**
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 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
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $this->cache->delete($key);
203 203
     }
204 204
 
205
-    public function testGetMultiple(){
205
+    public function testGetMultiple() {
206 206
 
207 207
         $expected = [
208 208
             'foo' => 'fooValue',
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         $i = 0;
214 214
 
215
-        foreach ($expected as $key => $value){
215
+        foreach ($expected as $key => $value) {
216 216
 
217 217
             $this->storageMock->expects($this->at($i))
218 218
                 ->method('get')
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     }
231 231
 
232
-    public function testSetMultiple(){
232
+    public function testSetMultiple() {
233 233
 
234 234
         $keys = [
235 235
             'foo' => 'fooValue',
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $i = 0;
244 244
         $expires = 60 * 60;
245 245
 
246
-        foreach ($keys as $key => $value){
246
+        foreach ($keys as $key => $value) {
247 247
             $this->storageMock->expects($this->at($i))
248 248
                 ->method('set')
249 249
                 ->with(
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
             $i++;
256 256
         }
257 257
 
258
-        $actual = $this->cache->setMultiple($keys,$expires);
258
+        $actual = $this->cache->setMultiple($keys, $expires);
259 259
         $this->assertEquals($expected, $actual);
260 260
     }
261 261
 
262
-    public function testDeleteMultiple(){
262
+    public function testDeleteMultiple() {
263 263
 
264
-        $keys = ['foo','bar','baz'];
264
+        $keys = ['foo', 'bar', 'baz'];
265 265
         $deleteStatus = true;
266 266
         $expected = true;
267 267
 
268
-        foreach ($keys as $i => $key){
268
+        foreach ($keys as $i => $key) {
269 269
             $this->storageMock->expects($this->at($i))
270 270
                 ->method('delete')
271 271
                 ->with(
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
         $this->assertEquals($expected, $actual);
279 279
     }
280 280
 
281
-    public function testDeleteMultipleFailure(){
281
+    public function testDeleteMultipleFailure() {
282 282
 
283
-        $keys = ['foo','bar','baz'];
283
+        $keys = ['foo', 'bar', 'baz'];
284 284
         $expected = false;
285 285
         $deleteStatus = true;
286 286
 
287
-        foreach ($keys as $i => $key){
287
+        foreach ($keys as $i => $key) {
288 288
 
289
-            if ($i === 1){
289
+            if ($i === 1) {
290 290
                 $deleteStatus = false;
291 291
             }
292 292
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         $this->assertEquals($expected, $actual);
303 303
     }
304 304
 
305
-    public function testclear(){
305
+    public function testclear() {
306 306
         $this->storageMock->expects($this->once())
307 307
             ->method('clear');
308 308
 
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
     /**
313 313
      * Private functions
314 314
      */
315
-    public function test_isValidKeyValid(){}
316
-    public function test_isValidKeyInvalid(){}
317
-    public function test_checkTraversableArray(){}
318
-    public function test_checkTraversableTraversable(){}
319
-    public function test_checkTraversableException(){}
320
-    public function test_hasFailureNoFailure(){}
321
-    public function test_hasFailureException(){}
315
+    public function test_isValidKeyValid() {}
316
+    public function test_isValidKeyInvalid() {}
317
+    public function test_checkTraversableArray() {}
318
+    public function test_checkTraversableTraversable() {}
319
+    public function test_checkTraversableException() {}
320
+    public function test_hasFailureNoFailure() {}
321
+    public function test_hasFailureException() {}
322 322
 }
Please login to merge, or discard this patch.
Tests/Cache/Mock/AbstractCacheMock.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,5 +11,5 @@
 block discarded – undo
11 11
  *
12 12
  * @package Tests\Cache\Mock
13 13
  */
14
-class AbstractCacheMock extends AbstractCache{
14
+class AbstractCacheMock extends AbstractCache {
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Tests/Cache/Mock/AbstractStorageMock.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  *
12 12
  * @package Tests\Cache\Mock
13 13
  */
14
-class AbstractStorageMock extends AbstractStorage{
14
+class AbstractStorageMock extends AbstractStorage {
15 15
 
16 16
     public function set($key, $value, $ttl = null)
17 17
     {
Please login to merge, or discard this patch.
Tests/Cache/Storage/MemcacheStorageTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     {
37 37
         $this->ttl = new \DateInterval('P1M');
38 38
         $this->memcacheMock = $this->getMockBuilder('\Memcached')->getMock();
39
-        $this->memcacheStorage = new MemcacheStorage($this->memcacheMock,'localhost',11211, $this->ttl);
39
+        $this->memcacheStorage = new MemcacheStorage($this->memcacheMock, 'localhost', 11211, $this->ttl);
40 40
     }
41 41
 
42 42
     public function testAddServer()
Please login to merge, or discard this patch.
Tests/Cache/Storage/NullStorageTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@
 block discarded – undo
28 28
     /**
29 29
      *
30 30
      */
31
-    public function testHas(){
31
+    public function testHas() {
32 32
         $this->assertEquals($this->cacheStorage->has('key', 'value'), false);
33 33
     }
34 34
 
35 35
     /**
36 36
      *
37 37
      */
38
-    public function testSet(){
38
+    public function testSet() {
39 39
         $this->assertEquals($this->cacheStorage->set('key', 'value', 10), true);
40 40
     }
41 41
 
42 42
     /**
43 43
      *
44 44
      */
45
-    public function testGet(){
45
+    public function testGet() {
46 46
         $this->assertEquals($this->cacheStorage->get('key'), null);
47 47
     }
48 48
 
49 49
     /**
50 50
      *
51 51
      */
52
-    public function testDelete(){
52
+    public function testDelete() {
53 53
         $this->assertEquals($this->cacheStorage->delete('key'), true);
54 54
     }
55 55
 
56 56
     /**
57 57
      *
58 58
      */
59
-    public function testClear(){
59
+    public function testClear() {
60 60
         $this->assertEquals($this->cacheStorage->clear(), true);
61 61
     }
62 62
     
Please login to merge, or discard this patch.
Tests/Cache/Storage/AbstractStorageTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * Test immutable setter AbstractStorage::withTtl
35 35
      */
36
-    public function testWithTtl(){
36
+    public function testWithTtl() {
37 37
         $newDateInterval = new \DateInterval('P2M');
38 38
         $newTtl = $this->abstractStorage->withTtl($newDateInterval);
39 39
         $this->assertNotSame($this->abstractStorage->getTtl(), $newTtl->getTtl());
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * Test getter AbstractStorage::getTtl
44 44
      */
45
-    public function testGetTtl(){
45
+    public function testGetTtl() {
46 46
         $ttl = $this->abstractStorage->getTtl();
47 47
         $this->assertSame($this->ttl, $ttl);
48 48
     }
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * Get get ttl when provided with null
52 52
      */
53
-    public function testGetTtlTimestampWhenNull(){
53
+    public function testGetTtlTimestampWhenNull() {
54 54
         $dateTime = new \DateTime();
55
-        $dateTime->add( $this->ttl );
55
+        $dateTime->add($this->ttl);
56 56
         $expected = $dateTime->getTimestamp();
57 57
         $actual = $this->abstractStorage->getTtlTimestamp(null);
58 58
         $this->assertEquals($expected, $actual);
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * Test get ttl when provided with an integer.
63 63
      */
64
-    public function testGetTtlTimestampWhenInt(){
65
-        $expected = 60*60*7;
64
+    public function testGetTtlTimestampWhenInt() {
65
+        $expected = 60 * 60 * 7;
66 66
         $actual = $this->abstractStorage->getTtlTimestamp($expected);
67 67
         $this->assertEquals($expected, $actual);
68 68
     }
Please login to merge, or discard this patch.
Tests/Cache/AbstractCacheTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
     /**
32 32
      * Test that NullStorage Adaptor is called by default.
33 33
      */
34
-    public function testConstructNullStorage(){
34
+    public function testConstructNullStorage() {
35 35
         $cache = new Cache();
36 36
         $storage = $cache->getCacheStorage();
37
-        $this->assertInstanceOf(NullStorage::class,$storage);
37
+        $this->assertInstanceOf(NullStorage::class, $storage);
38 38
     }
39 39
 
40 40
     /**
41 41
      * Test CacheStorage is updated from construct.
42 42
      */
43
-    public function testConstructWithStorage(){
43
+    public function testConstructWithStorage() {
44 44
         $cache = new Cache($this->storageMock);
45 45
         $storage = $cache->getCacheStorage();
46
-        $this->assertSame($this->storageMock,$storage);
46
+        $this->assertSame($this->storageMock, $storage);
47 47
     }
48 48
 
49 49
     /**
Please login to merge, or discard this patch.
Src/Cache/Storage/MemcacheStorage.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return bool
69 69
      */
70
-    public function has($key){
71
-        if (!empty($this->mmc->get($key))){
70
+    public function has($key) {
71
+        if (!empty($this->mmc->get($key))) {
72 72
             return true;
73 73
         }
74 74
         return false;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      *
114 114
      * @return bool True on success and false on failure.
115 115
      */
116
-    public function clear(){
116
+    public function clear() {
117 117
         return $this->flush();
118 118
     }
119 119
 
Please login to merge, or discard this patch.
Src/Cache/Storage/NullStorage.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * NullStorage constructor.
24 24
      */
25
-    public function __construct(){}
25
+    public function __construct() {}
26 26
 
27 27
     /**
28 28
      * Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @return mixed The value of the item from the cache, or $default in case of cache miss.
49 49
      *
50 50
      */
51
-    public function get($key){
51
+    public function get($key) {
52 52
         return null;
53 53
     }
54 54
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return bool
66 66
      */
67
-    public function has($key){
67
+    public function has($key) {
68 68
         return false;
69 69
     }
70 70
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return bool True on success and false on failure.
87 87
      */
88
-    public function clear(){
88
+    public function clear() {
89 89
         return true;
90 90
     }
91 91
 }
Please login to merge, or discard this patch.