File tree Expand file tree Collapse file tree 3 files changed +29
-17
lines changed
Expand file tree Collapse file tree 3 files changed +29
-17
lines changed Original file line number Diff line number Diff line change 2020 "php-coveralls/php-coveralls" : " ^2.2"
2121 },
2222 "scripts" : {
23- "test" : " php vendor/phpunit/phpunit/phpunit" ,
24- "test-coverage" : " php vendor/phpunit/phpunit/phpunit --coverage-clover build/logs/clover.xml"
23+ "test" : " php vendor/phpunit/phpunit/phpunit"
2524 },
2625 "autoload" : {
2726 "psr-4" : {
Original file line number Diff line number Diff line change @@ -43,16 +43,6 @@ public function add(string $key, $value)
4343 return true ;
4444 }
4545
46- /**
47- * Counts all files in the cache
48- *
49- * @return int
50- */
51- public function count (): int
52- {
53- return $ this ->cache ->count ();
54- }
55-
5646 /**
5747 * Deletes an item from the cache
5848 *
Original file line number Diff line number Diff line change 77
88class CacheTest extends TestCase {
99
10- public function testCache ()
10+ public function testAddToCache ()
1111 {
1212 $ cache = new Cache ;
13- $ cache_testStore = [
13+ $ testData = [
1414 "title " => "Interstellar "
1515 ];
1616
17- $ cache ->add ("test " , $ cache_testStore );
18- $ cache_testFile = $ cache ->get ("test " );
17+ $ cache ->add ("test " , $ testData );
18+ $ testFile = $ cache ->get ("test " );
1919
20- $ this ->assertEquals ($ cache_testStore , $ cache_testFile ->film );
20+ $ this ->assertEquals ($ testData , $ testFile ->film );
21+
22+ $ cache ->delete ("test " );
23+ }
24+
25+ public function testHasCache ()
26+ {
27+ $ cache = new Cache ;
28+ $ cache ->add ("testHas " , [ "test " => "has " ]);
29+
30+ $ this ->assertEquals (true , $ cache ->has ("testHas " ));
31+ $ this ->assertEquals (false , $ cache ->has ("testHasNot " ));
32+
33+ $ cache ->delete ("testHas " );
34+ }
35+
36+ public function testDeleteFromCache ()
37+ {
38+ $ cache = new Cache ;
39+ $ cache ->add ("testHas " , [ "test " => "has " ]);
40+
41+ $ this ->assertEquals (true , $ cache ->has ("testHas " ));
42+ $ cache ->delete ("testHas " );
43+ $ this ->assertEquals (false , $ cache ->has ("testHas " ));
2144 }
2245
2346}
You can’t perform that action at this time.
0 commit comments