@@ -161,61 +161,6 @@ public function testAutoRegenerateId() : void
161161 );
162162 }
163163
164- /**
165- * @return Generator<array<SaveHandler>>
166- */
167- public function saveHandlerProvider () : Generator
168- {
169- $ directory = \sys_get_temp_dir () . '/sessions ' ;
170- if (!\is_dir ($ directory )) {
171- \mkdir ($ directory );
172- }
173- yield [
174- new FilesHandler ([
175- 'directory ' => $ directory ,
176- ]),
177- ];
178- yield [
179- new MemcachedHandler ([
180- 'servers ' => [
181- [
182- 'host ' => \getenv ('MEMCACHED_HOST ' ),
183- ],
184- [
185- // @phpstan-ignore-next-line
186- 'host ' => \gethostbyname (\getenv ('MEMCACHED_HOST ' )),
187- ],
188- ],
189- ]),
190- ];
191- yield [
192- new RedisHandler ([
193- 'host ' => \getenv ('REDIS_HOST ' ),
194- ]),
195- ];
196- $ config = [
197- 'username ' => \getenv ('DB_USERNAME ' ),
198- 'password ' => \getenv ('DB_PASSWORD ' ),
199- 'schema ' => \getenv ('DB_SCHEMA ' ),
200- 'host ' => \getenv ('DB_HOST ' ),
201- 'port ' => \getenv ('DB_PORT ' ),
202- 'table ' => \getenv ('DB_TABLE ' ),
203- ];
204- $ database = new Database ($ config );
205- $ database ->dropTable ($ config ['table ' ])->ifExists ()->run (); // @phpstan-ignore-line
206- // @phpstan-ignore-next-line
207- $ database ->createTable ($ config ['table ' ])
208- ->definition (static function (TableDefinition $ definition ) : void {
209- $ definition ->column ('id ' )->varchar (128 )->primaryKey ();
210- $ definition ->column ('timestamp ' )->timestamp ();
211- $ definition ->column ('data ' )->blob ();
212- $ definition ->index ('timestamp ' )->key ('timestamp ' );
213- })->run ();
214- yield [
215- new DatabaseHandler ($ config ),
216- ];
217- }
218-
219164 /**
220165 * @dataProvider saveHandlerProvider
221166 *
@@ -284,4 +229,59 @@ protected function unlock() : bool
284229 $ this ->collector ->getContents ()
285230 );
286231 }
232+
233+ /**
234+ * @return Generator<array<SaveHandler>>
235+ */
236+ public static function saveHandlerProvider () : Generator
237+ {
238+ $ directory = \sys_get_temp_dir () . '/sessions ' ;
239+ if (!\is_dir ($ directory )) {
240+ \mkdir ($ directory );
241+ }
242+ yield [
243+ new FilesHandler ([
244+ 'directory ' => $ directory ,
245+ ]),
246+ ];
247+ yield [
248+ new MemcachedHandler ([
249+ 'servers ' => [
250+ [
251+ 'host ' => \getenv ('MEMCACHED_HOST ' ),
252+ ],
253+ [
254+ // @phpstan-ignore-next-line
255+ 'host ' => \gethostbyname (\getenv ('MEMCACHED_HOST ' )),
256+ ],
257+ ],
258+ ]),
259+ ];
260+ yield [
261+ new RedisHandler ([
262+ 'host ' => \getenv ('REDIS_HOST ' ),
263+ ]),
264+ ];
265+ $ config = [
266+ 'username ' => \getenv ('DB_USERNAME ' ),
267+ 'password ' => \getenv ('DB_PASSWORD ' ),
268+ 'schema ' => \getenv ('DB_SCHEMA ' ),
269+ 'host ' => \getenv ('DB_HOST ' ),
270+ 'port ' => \getenv ('DB_PORT ' ),
271+ 'table ' => \getenv ('DB_TABLE ' ),
272+ ];
273+ $ database = new Database ($ config );
274+ $ database ->dropTable ($ config ['table ' ])->ifExists ()->run (); // @phpstan-ignore-line
275+ // @phpstan-ignore-next-line
276+ $ database ->createTable ($ config ['table ' ])
277+ ->definition (static function (TableDefinition $ definition ) : void {
278+ $ definition ->column ('id ' )->varchar (128 )->primaryKey ();
279+ $ definition ->column ('timestamp ' )->timestamp ();
280+ $ definition ->column ('data ' )->blob ();
281+ $ definition ->index ('timestamp ' )->key ('timestamp ' );
282+ })->run ();
283+ yield [
284+ new DatabaseHandler ($ config ),
285+ ];
286+ }
287287}
0 commit comments