File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,16 @@ public function clear(): self
311311 return $ this ;
312312 }
313313
314+ /**
315+ * Retrieve all session data.
316+ *
317+ * @return array An associative array containing all session data.
318+ */
319+ public function getAll (): array
320+ {
321+ return $ this ->data ;
322+ }
323+
314324 /**
315325 * Commits the current session data and writes it to the storage.
316326 *
Original file line number Diff line number Diff line change @@ -477,4 +477,26 @@ public function testWriteWithNoChanges(): void
477477 $ result = $ writeMethod ->invoke ($ session , $ sessionId , 'data ' );
478478 $ this ->assertTrue ($ result );
479479 }
480- }
480+
481+ public function testGetAll (): void
482+ {
483+ $ session = new Session ([
484+ 'save_path ' => $ this ->tempDir ,
485+ 'encryption_key ' => null ,
486+ 'auto_commit ' => false ,
487+ 'start_session ' => false ,
488+ 'test_mode ' => true
489+ ]);
490+
491+ $ session ->set ('key1 ' , 'value1 ' );
492+ $ session ->set ('key2 ' , 'value2 ' );
493+
494+ $ expectedData = [
495+ 'key1 ' => 'value1 ' ,
496+ 'key2 ' => 'value2 '
497+ ];
498+
499+ $ this ->assertEquals ($ expectedData , $ session ->getAll ());
500+ }
501+
502+ }
You can’t perform that action at this time.
0 commit comments