1212final class InMemoryCacheTest extends TestCase
1313{
1414 private FrozenClock $ clock ;
15+
1516 private InMemoryCache $ pool ;
1617
1718 protected function setUp (): void
@@ -25,21 +26,21 @@ public function testItWorksWithoutProvidingAClock(): void
2526 $ pool = new InMemoryCache ();
2627 $ item = $ pool ->getItem ('item ' );
2728
28- self :: assertFalse ($ item ->isHit ());
29+ $ this -> assertFalse ($ item ->isHit ());
2930
3031 $ item ->set ('value ' )->expiresAfter (new \DateInterval ('PT5M ' ));
3132 $ pool ->save ($ item );
3233
3334 $ item = $ pool ->getItem ('item ' );
34- self :: assertTrue ($ item ->isHit ());
35+ $ this -> assertTrue ($ item ->isHit ());
3536 }
3637
3738 public function testItReturnsANewItem (): void
3839 {
3940 $ item = $ this ->pool ->getItem ('item ' );
4041
41- self :: assertFalse ($ item ->isHit ());
42- self :: assertNull ($ item ->get ());
42+ $ this -> assertFalse ($ item ->isHit ());
43+ $ this -> assertNull ($ item ->get ());
4344 }
4445
4546 public function testItUsesTheProvidedClock (): void
@@ -50,10 +51,10 @@ public function testItUsesTheProvidedClock(): void
5051 $ this ->pool ->save ($ item );
5152
5253 $ this ->clock ->setTo ($ this ->clock ->now ()->add (new \DateInterval ('PT1H ' )));
53- self :: assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
54+ $ this -> assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
5455
5556 $ this ->clock ->setTo ($ this ->clock ->now ()->add (new \DateInterval ('PT2H ' )));
56- self :: assertFalse ($ this ->pool ->getItem ('item ' )->isHit ());
57+ $ this -> assertFalse ($ this ->pool ->getItem ('item ' )->isHit ());
5758 }
5859
5960 public function testItSavesAnItem (): void
@@ -63,19 +64,19 @@ public function testItSavesAnItem(): void
6364 $ item ->set ('value ' );
6465 $ this ->pool ->save ($ item );
6566
66- self :: assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
67- self :: assertSame ('value ' , $ this ->pool ->getItem ('item ' )->get ());
67+ $ this -> assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
68+ $ this -> assertSame ('value ' , $ this ->pool ->getItem ('item ' )->get ());
6869 }
6970
7071 public function testItHasAnItem (): void
7172 {
72- self :: assertFalse ($ this ->pool ->hasItem ('key ' ));
73+ $ this -> assertFalse ($ this ->pool ->hasItem ('key ' ));
7374
7475 $ item = $ this ->pool ->getItem ('key ' );
7576 $ item ->set ('value ' );
7677 $ this ->pool ->save ($ item );
7778
78- self :: assertTrue ($ this ->pool ->hasItem ('key ' ));
79+ $ this -> assertTrue ($ this ->pool ->hasItem ('key ' ));
7980 }
8081
8182 public function testItCommitsDeferredItems (): void
@@ -86,22 +87,22 @@ public function testItCommitsDeferredItems(): void
8687
8788 $ this ->pool ->saveDeferred ($ item );
8889
89- self :: assertFalse ($ this ->pool ->getItem ('item ' )->isHit ());
90+ $ this -> assertFalse ($ this ->pool ->getItem ('item ' )->isHit ());
9091
9192 $ this ->pool ->commit ();
9293
93- self :: assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
94+ $ this -> assertTrue ($ this ->pool ->getItem ('item ' )->isHit ());
9495 }
9596
9697 public function testItCanBeCleared (): void
9798 {
9899 $ this ->pool ->save ($ this ->pool ->getItem ('key ' )->set ('value ' ));
99100
100- self :: assertTrue ($ this ->pool ->getItem ('key ' )->isHit ());
101+ $ this -> assertTrue ($ this ->pool ->getItem ('key ' )->isHit ());
101102
102103 $ this ->pool ->clear ();
103104
104- self :: assertFalse ($ this ->pool ->getItem ('key ' )->isHit ());
105+ $ this -> assertFalse ($ this ->pool ->getItem ('key ' )->isHit ());
105106 }
106107
107108 public function testItReturnsMultipleItems (): void
@@ -111,35 +112,35 @@ public function testItReturnsMultipleItems(): void
111112
112113 $ items = $ this ->pool ->getItems (['first ' , 'second ' , 'third ' ]);
113114
114- self :: assertCount (3 , $ items );
115- self :: assertIsArray ($ items );
115+ $ this -> assertCount (3 , $ items );
116+ $ this -> assertIsArray ($ items );
116117
117- self :: assertArrayHasKey ('first ' , $ items );
118- self :: assertTrue ($ items ['first ' ]->isHit ());
118+ $ this -> assertArrayHasKey ('first ' , $ items );
119+ $ this -> assertTrue ($ items ['first ' ]->isHit ());
119120
120- self :: assertArrayHasKey ('second ' , $ items );
121- self :: assertFalse ($ items ['second ' ]->isHit ());
121+ $ this -> assertArrayHasKey ('second ' , $ items );
122+ $ this -> assertFalse ($ items ['second ' ]->isHit ());
122123
123- self :: assertArrayHasKey ('third ' , $ items );
124- self :: assertTrue ($ items ['third ' ]->isHit ());
124+ $ this -> assertArrayHasKey ('third ' , $ items );
125+ $ this -> assertTrue ($ items ['third ' ]->isHit ());
125126 }
126127
127128 public function testItReturnsNoItemsWhenNoKeysAreGiven (): void
128129 {
129130 $ this ->pool ->save ($ this ->pool ->getItem ('key ' )->set ('value ' ));
130131
131- self :: assertEmpty ($ this ->pool ->getItems ());
132+ $ this -> assertEmpty ($ this ->pool ->getItems ());
132133 }
133134
134135 public function testItDeletesAnItem (): void
135136 {
136137 $ this ->pool ->save ($ this ->pool ->getItem ('key ' )->set ('value ' ));
137138
138- self :: assertTrue ($ this ->pool ->hasItem ('key ' ));
139+ $ this -> assertTrue ($ this ->pool ->hasItem ('key ' ));
139140
140141 $ this ->pool ->deleteItem ('key ' );
141142
142- self :: assertFalse ($ this ->pool ->hasItem ('key ' ));
143+ $ this -> assertFalse ($ this ->pool ->hasItem ('key ' ));
143144 }
144145
145146 public function testItDeletesMultipleItems (): void
@@ -150,9 +151,9 @@ public function testItDeletesMultipleItems(): void
150151
151152 $ this ->pool ->deleteItems (['first ' , 'third ' , 'fourth ' ]);
152153
153- self :: assertFalse ($ this ->pool ->hasItem ('first ' ));
154- self :: assertTrue ($ this ->pool ->hasItem ('second ' ));
155- self :: assertFalse ($ this ->pool ->hasItem ('third ' ));
156- self :: assertFalse ($ this ->pool ->hasItem ('fourth ' ));
154+ $ this -> assertFalse ($ this ->pool ->hasItem ('first ' ));
155+ $ this -> assertTrue ($ this ->pool ->hasItem ('second ' ));
156+ $ this -> assertFalse ($ this ->pool ->hasItem ('third ' ));
157+ $ this -> assertFalse ($ this ->pool ->hasItem ('fourth ' ));
157158 }
158159}
0 commit comments