1717
1818namespace Google \Auth \Tests \Cache ;
1919
20- use Google \Auth \Cache \Item ;
2120use Google \Auth \Cache \TypedItem ;
2221use PHPUnit \Framework \TestCase ;
2322
2423class ItemTest extends TestCase
2524{
26- public function getItem ($ key )
27- {
28- if (\PHP_VERSION_ID >= 80000 ) {
29- return new TypedItem ($ key );
30- }
31-
32- return new Item ($ key );
33- }
34-
3525 public function testGetsKey ()
3626 {
37- $ key = 'item ' ;
27+ $ item = new TypedItem ( 'item ' ) ;
3828
39- $ this ->assertEquals ($ key , $ this -> getItem ( $ key ) ->getKey ());
29+ $ this ->assertEquals (' item ' , $ item ->getKey ());
4030 }
4131
4232 public function testGetsNull ()
4333 {
44- $ item = $ this -> getItem ('item ' );
34+ $ item = new TypedItem ('item ' );
4535
4636 $ this ->assertNull ($ item ->get ());
4737 $ this ->assertFalse ($ item ->isHit ());
@@ -50,7 +40,7 @@ public function testGetsNull()
5040 public function testGetsValue ()
5141 {
5242 $ value = 'value ' ;
53- $ item = $ this -> getItem ('item ' );
43+ $ item = new TypedItem ('item ' );
5444 $ item ->set ($ value );
5545
5646 $ this ->assertEquals ('value ' , $ item ->get ());
@@ -61,7 +51,7 @@ public function testGetsValue()
6151 */
6252 public function testSetsValue ($ value )
6353 {
64- $ item = $ this -> getItem ('item ' );
54+ $ item = new TypedItem ('item ' );
6555 $ item ->set ($ value );
6656
6757 $ this ->assertEquals ($ value , $ item ->get ());
@@ -82,7 +72,7 @@ public function values()
8272
8373 public function testIsHit ()
8474 {
85- $ item = $ this -> getItem ('item ' );
75+ $ item = new TypedItem ('item ' );
8676
8777 $ this ->assertFalse ($ item ->isHit ());
8878
@@ -93,7 +83,7 @@ public function testIsHit()
9383
9484 public function testExpiresAt ()
9585 {
96- $ item = $ this -> getItem ('item ' );
86+ $ item = new TypedItem ('item ' );
9787 $ item ->set ('value ' );
9888 $ item ->expiresAt (new \DateTime ('now + 1 hour ' ));
9989
@@ -110,7 +100,7 @@ public function testExpiresAt()
110100
111101 public function testExpiresAfter ()
112102 {
113- $ item = $ this -> getItem ('item ' );
103+ $ item = new TypedItem ('item ' );
114104 $ item ->set ('value ' );
115105 $ item ->expiresAfter (30 );
116106
0 commit comments