@@ -101,7 +101,8 @@ public function testRemove()
101101 public function testStartException ()
102102 {
103103 static ::expectException (Exception::class);
104- Session::start (['read_and_write ' => false ]);
104+ Session::setReadWrite ();
105+ Session::start ();
105106 Session::start ();
106107 }
107108
@@ -111,7 +112,8 @@ public function testStartException()
111112 public function testUseDefaultDriverWhenAlreadyStartedException ()
112113 {
113114 static ::expectException (Exception::class);
114- Session::start (['read_and_write ' => false ]);
115+ Session::setReadWrite ();
116+ Session::start ();
115117 Session::useDefaultDriver ();
116118 }
117119
@@ -121,7 +123,8 @@ public function testUseDefaultDriverWhenAlreadyStartedException()
121123 public function testUseFileDriverWhenAlreadyStartedException ()
122124 {
123125 static ::expectException (Exception::class);
124- Session::start (['read_and_write ' => false ]);
126+ Session::setReadWrite ();
127+ Session::start ();
125128 Session::useFileDriver ();
126129 }
127130
@@ -131,7 +134,8 @@ public function testUseFileDriverWhenAlreadyStartedException()
131134 public function testUseCustomDriverWhenAlreadyStartedException ()
132135 {
133136 static ::expectException (Exception::class);
134- Session::start (['read_and_write ' => false ]);
137+ Session::setReadWrite ();
138+ Session::start ();
135139 Session::useCustomDriver (new File ());
136140 }
137141
@@ -340,4 +344,62 @@ public function testUseEncryptionDriverThrowExceptionWhenMethodIncrorrect()
340344 }
341345
342346 //exception quand methode pas bonne dans les encryption
347+
348+ /**
349+ * @runInSeparateProcess
350+ */
351+ public function testSetOption ()
352+ {
353+ $ defaultOption = Session::getOption ('name ' );
354+ static ::assertEquals ($ defaultOption , ini_get ('session.name ' ));
355+
356+ Session::setOption ('name ' , 'my_custom_name ' );
357+ $ customOption = Session::getOption ('name ' );
358+
359+ static ::assertEquals ('my_custom_name ' , $ customOption );
360+
361+ Session::start (['name ' => 'my_other_name ' ]);
362+
363+ $ customOption = Session::getOption ('name ' );
364+ static ::assertEquals ('my_other_name ' , $ customOption );
365+ }
366+
367+ /**
368+ * @runInSeparateProcess
369+ */
370+ public function testSetOptionThrowException ()
371+ {
372+ static ::expectException (Exception::class);
373+ Session::getOption ('azerty ' );
374+ }
375+
376+ /**
377+ * @runInSeparateProcess
378+ */
379+ public function testGetAll ()
380+ {
381+ $ sessionValues = Session::getAll ();
382+ static ::assertTrue (empty ($ sessionValues ));
383+
384+ Session::set ('a ' , 'b ' );
385+
386+ $ sessionValues = Session::getAll ();
387+ static ::assertEquals (['a ' => 'b ' ], $ sessionValues );
388+ }
389+
390+ /**
391+ * @runInSeparateProcess
392+ */
393+ public function testFlash ()
394+ {
395+ Session::setFlash ('a ' , 'b ' );
396+ Session::setFlash ('y ' , 'u ' );
397+ static ::assertTrue (Session::hasFlash ('a ' ));
398+ static ::assertEquals ('b ' , Session::getFlash ('a ' ));
399+ Session::start (['lazy_write ' => '0 ' ]);
400+ Session::keepFlash (['y ' ]);
401+ static ::assertEquals (['flash_data ' => 'u ' ], $ _SESSION );
402+ Session::commit ();
403+ session_start ();
404+ }
343405}
0 commit comments