@@ -74,8 +74,8 @@ public function testCloseSession()
74
74
75
75
public function testReadSession ()
76
76
{
77
- $ this ->setFixture (self ::PREFIX .'id1 ' , null );
78
- $ this ->setFixture (self ::PREFIX .'id2 ' , 'abc123 ' );
77
+ $ this ->redisClient -> set (self ::PREFIX .'id1 ' , null );
78
+ $ this ->redisClient -> set (self ::PREFIX .'id2 ' , 'abc123 ' );
79
79
80
80
$ this ->assertEquals ('' , $ this ->storage ->read ('id1 ' ));
81
81
$ this ->assertEquals ('abc123 ' , $ this ->storage ->read ('id2 ' ));
@@ -85,26 +85,26 @@ public function testWriteSession()
85
85
{
86
86
$ this ->assertTrue ($ this ->storage ->write ('id ' , 'data ' ));
87
87
88
- $ this ->assertTrue ($ this ->hasFixture (self ::PREFIX .'id ' ));
89
- $ this ->assertEquals ('data ' , $ this ->getFixture (self ::PREFIX .'id ' ));
88
+ $ this ->assertTrue (( bool ) $ this ->redisClient -> exists (self ::PREFIX .'id ' ));
89
+ $ this ->assertEquals ('data ' , $ this ->redisClient -> get (self ::PREFIX .'id ' ));
90
90
}
91
91
92
92
public function testUseSessionGcMaxLifetimeAsTimeToLive ()
93
93
{
94
94
$ this ->storage ->write ('id ' , 'data ' );
95
- $ ttl = $ this ->fixtureTtl (self ::PREFIX .'id ' );
95
+ $ ttl = $ this ->redisClient -> ttl (self ::PREFIX .'id ' );
96
96
97
97
$ this ->assertLessThanOrEqual (ini_get ('session.gc_maxlifetime ' ), $ ttl );
98
98
$ this ->assertGreaterThanOrEqual (0 , $ ttl );
99
99
}
100
100
101
101
public function testDestroySession ()
102
102
{
103
- $ this ->setFixture (self ::PREFIX .'id ' , 'foo ' );
103
+ $ this ->redisClient -> set (self ::PREFIX .'id ' , 'foo ' );
104
104
105
- $ this ->assertTrue ($ this ->hasFixture (self ::PREFIX .'id ' ));
105
+ $ this ->assertTrue (( bool ) $ this ->redisClient -> exists (self ::PREFIX .'id ' ));
106
106
$ this ->assertTrue ($ this ->storage ->destroy ('id ' ));
107
- $ this ->assertFalse ($ this ->hasFixture (self ::PREFIX .'id ' ));
107
+ $ this ->assertFalse (( bool ) $ this ->redisClient -> exists (self ::PREFIX .'id ' ));
108
108
}
109
109
110
110
public function testGcSession ()
@@ -114,12 +114,12 @@ public function testGcSession()
114
114
115
115
public function testUpdateTimestamp ()
116
116
{
117
- $ lowTTL = 10 ;
117
+ $ lowTtl = 10 ;
118
118
119
- $ this ->setFixture (self ::PREFIX .'id ' , 'foo ' , $ lowTTL );
119
+ $ this ->redisClient -> setex (self ::PREFIX .'id ' , $ lowTtl , 'foo ' );
120
120
$ this ->storage ->updateTimestamp ('id ' , array ());
121
121
122
- $ this ->assertGreaterThan ($ lowTTL , $ this ->fixtureTtl (self ::PREFIX .'id ' ));
122
+ $ this ->assertGreaterThan ($ lowTtl , $ this ->redisClient -> ttl (self ::PREFIX .'id ' ));
123
123
}
124
124
125
125
/**
@@ -142,28 +142,4 @@ public function getOptionFixtures(): array
142
142
array (array ('prefix ' => 'sfs ' , 'foo ' => 'bar ' ), false ),
143
143
);
144
144
}
145
-
146
- protected function setFixture ($ key , $ value , $ ttl = null )
147
- {
148
- if (null !== $ ttl ) {
149
- $ this ->redisClient ->setex ($ key , $ ttl , $ value );
150
- } else {
151
- $ this ->redisClient ->set ($ key , $ value );
152
- }
153
- }
154
-
155
- protected function getFixture ($ key )
156
- {
157
- return $ this ->redisClient ->get ($ key );
158
- }
159
-
160
- protected function hasFixture ($ key ): bool
161
- {
162
- return $ this ->redisClient ->exists ($ key );
163
- }
164
-
165
- protected function fixtureTtl ($ key ): int
166
- {
167
- return $ this ->redisClient ->ttl ($ key );
168
- }
169
145
}
0 commit comments