11<?php
22
33/*
4- * To change this license header, choose License Headers in Project Properties.
5- * To change this template file, choose Tools | Templates
6- * and open the template in the editor.
4+ * This file is part of php-cache organization.
5+ *
6+ * (c) 2015 Aaron Scherer <[email protected] >, Tobias Nyholm <[email protected] > 7+ *
8+ * This source file is subject to the MIT license that is bundled
9+ * with this source code in the file LICENSE.
710 */
811
912namespace Cache \Prefixed \Tests ;
1013
11- use Psr \SimpleCache \CacheInterface ;
1214use Cache \Prefixed \PrefixedSimpleCache ;
15+ use Psr \SimpleCache \CacheInterface ;
1316
1417/**
15- * Description of PrefixedSimpleCacheTest
18+ * Description of PrefixedSimpleCacheTest.
1619 *
1720 * @author ndobromirov
1821 */
1922class PrefixedSimpleCacheTest extends \PHPUnit_Framework_TestCase
2023{
2124 /**
22- * @param string $method Method name to mock.
23- * @param array $arguments List of expected arguments.
24- * @param type $result
25+ * @param string $method Method name to mock.
26+ * @param array $arguments List of expected arguments.
27+ * @param type $result
28+ *
2529 * @return \PHPUnit_Framework_MockObject_MockObject
2630 */
2731 private function getCacheStub ($ method , $ arguments , $ result )
@@ -36,64 +40,63 @@ private function getCacheStub($method, $arguments, $result)
3640 return call_user_func_array ([$ stub , 'with ' ], $ arguments );
3741 }
3842
39-
4043 public function testGet ()
4144 {
4245 $ prefix = 'ns ' ;
43- $ key = 'key ' ;
44- $ returnValue = true ;
46+ $ key = 'key ' ;
47+ $ result = true ;
4548
46- $ stub = $ this ->getCacheStub ('get ' , [$ prefix . $ key ], $ returnValue );
49+ $ stub = $ this ->getCacheStub ('get ' , [$ prefix. $ key ], $ result );
4750 $ pool = (new PrefixedSimpleCache ($ stub , $ prefix ));
4851
49- $ this ->assertEquals ($ returnValue , $ pool ->get ($ key ));
52+ $ this ->assertEquals ($ result , $ pool ->get ($ key ));
5053 }
5154
5255 public function testSet ()
5356 {
5457 $ prefix = 'ns ' ;
55- $ key = 'key ' ;
56- $ returnValue = true ;
57- $ value = ' value ' ;
58+ $ key = 'key ' ;
59+ $ value = ' value ' ;
60+ $ result = true ;
5861
59- $ stub = $ this ->getCacheStub ('set ' , [$ prefix . $ key , $ value ], $ returnValue );
62+ $ stub = $ this ->getCacheStub ('set ' , [$ prefix. $ key , $ value ], $ result );
6063 $ pool = (new PrefixedSimpleCache ($ stub , $ prefix ));
6164
62- $ this ->assertEquals ($ returnValue , $ pool ->set ($ key , $ value ));
65+ $ this ->assertEquals ($ result , $ pool ->set ($ key , $ value ));
6366 }
6467
6568 public function testDelete ()
6669 {
6770 $ prefix = 'ns ' ;
68- $ key = 'key ' ;
69- $ returnValue = true ;
71+ $ key = 'key ' ;
72+ $ result = true ;
7073
71- $ stub = $ this ->getCacheStub ('delete ' , [[$ prefix . $ key ]], $ returnValue );
74+ $ stub = $ this ->getCacheStub ('delete ' , [[$ prefix. $ key ]], $ result );
7275 $ pool = (new PrefixedSimpleCache ($ stub , $ prefix ));
7376
74- $ this ->assertEquals ($ returnValue , $ pool ->delete ($ key ));
77+ $ this ->assertEquals ($ result , $ pool ->delete ($ key ));
7578 }
7679
7780 public function testClear ()
7881 {
7982 $ prefix = 'ns ' ;
80- $ returnValue = true ;
83+ $ result = true ;
8184
82- $ stub = $ this ->getCacheStub ('clear ' , [], $ returnValue );
85+ $ stub = $ this ->getCacheStub ('clear ' , [], $ result );
8386 $ pool = (new PrefixedSimpleCache ($ stub , $ prefix ));
8487
85- $ this ->assertEquals ($ returnValue , $ pool ->clear ());
88+ $ this ->assertEquals ($ result , $ pool ->clear ());
8689 }
8790
8891 public function testGetMultiple ()
8992 {
90- $ prefix = 'ns ' ;
91- list ($ key1 , $ value1 ) = ['key1 ' , 1 ];
92- list ($ key2 , $ value2 ) = ['key2 ' , 2 ];
93+ $ prefix = 'ns ' ;
94+ list ($ key1 , $ value1 ) = ['key1 ' , 1 ];
95+ list ($ key2 , $ value2 ) = ['key2 ' , 2 ];
9396
94- $ stub = $ this ->getCacheStub ('getMultiple ' , [[$ prefix . $ key1 , $ prefix . $ key2 ]], [
95- $ prefix . $ key1 => $ value1 ,
96- $ prefix . $ key2 => $ value2 ,
97+ $ stub = $ this ->getCacheStub ('getMultiple ' , [[$ prefix. $ key1 , $ prefix. $ key2 ]], [
98+ $ prefix. $ key1 => $ value1 ,
99+ $ prefix. $ key2 => $ value2 ,
97100 ]);
98101 $ pool = new PrefixedSimpleCache ($ stub , $ prefix );
99102
@@ -102,24 +105,24 @@ public function testGetMultiple()
102105
103106 public function testSetMultiple ()
104107 {
105- $ prefix = 'ns ' ;
106- list ($ key1 , $ value1 ) = ['key1 ' , 1 ];
107- list ($ key2 , $ value2 ) = ['key2 ' , 2 ];
108- $ result = true ;
108+ $ prefix = 'ns ' ;
109+ list ($ key1 , $ value1 ) = ['key1 ' , 1 ];
110+ list ($ key2 , $ value2 ) = ['key2 ' , 2 ];
111+ $ result = true ;
109112
110- $ stub = $ this ->getCacheStub ('setMultiple ' , [[$ prefix . $ key1 => $ value1 , $ prefix . $ key2 => $ value2 ]], $ result );
113+ $ stub = $ this ->getCacheStub ('setMultiple ' , [[$ prefix. $ key1 => $ value1 , $ prefix. $ key2 => $ value2 ]], $ result );
111114 $ pool = new PrefixedSimpleCache ($ stub , $ prefix );
112115
113116 $ this ->assertEquals ($ result , $ pool ->setMultiple ([$ key1 => $ value1 , $ key2 => $ value2 ]));
114117 }
115118
116119 public function testDeleteMultiple ()
117120 {
118- $ prefix = 'ns ' ;
119- list ($ key1 , $ key2 ) = ['key1 ' , 'key2 ' ];
120- $ result = true ;
121+ $ prefix = 'ns ' ;
122+ list ($ key1 , $ key2 ) = ['key1 ' , 'key2 ' ];
123+ $ result = true ;
121124
122- $ stub = $ this ->getCacheStub ('deleteMultiple ' , [[$ prefix . $ key1 , $ prefix . $ key2 ]], $ result );
125+ $ stub = $ this ->getCacheStub ('deleteMultiple ' , [[$ prefix. $ key1 , $ prefix. $ key2 ]], $ result );
123126 $ pool = new PrefixedSimpleCache ($ stub , $ prefix );
124127
125128 $ this ->assertEquals ($ result , $ pool ->deleteMultiple ([$ key1 , $ key2 ]));
@@ -128,10 +131,10 @@ public function testDeleteMultiple()
128131 public function testHas ()
129132 {
130133 $ prefix = 'ns ' ;
131- $ key = 'key ' ;
134+ $ key = 'key ' ;
132135 $ result = true ;
133136
134- $ stub = $ this ->getCacheStub ('has ' , [[$ prefix . $ key ]], $ result );
137+ $ stub = $ this ->getCacheStub ('has ' , [[$ prefix. $ key ]], $ result );
135138 $ pool = new PrefixedSimpleCache ($ stub , $ prefix );
136139
137140 $ this ->assertEquals ($ result , $ pool ->has ($ key ));
0 commit comments