@@ -115,6 +115,9 @@ class SessionManagerTest extends \PHPUnit\Framework\TestCase
115115 */
116116 private $ appState ;
117117
118+ /**
119+ * @inheritdoc
120+ */
118121 protected function setUp (): void
119122 {
120123 $ this ->sessionName = 'frontEndSession ' ;
@@ -250,8 +253,6 @@ public function testIsValidForHost()
250253 $ this ->model ->destroy ();
251254 }
252255
253- /**
254- */
255256 public function testStartAreaNotSet ()
256257 {
257258 $ this ->expectException (\Magento \Framework \Exception \SessionException::class);
@@ -283,17 +284,23 @@ public function testStartAreaNotSet()
283284 $ this ->model ->start ();
284285 }
285286
286- public function testConstructor ()
287+ /**
288+ * @param string $saveMethod
289+ * @dataProvider dataConstructor
290+ *
291+ * @return void
292+ */
293+ public function testConstructor (string $ saveMethod ): void
287294 {
288295 global $ mockPHPFunctions ;
289296 $ mockPHPFunctions = true ;
290297
291298 $ deploymentConfigMock = $ this ->createMock (DeploymentConfig::class);
292299 $ deploymentConfigMock ->method ('get ' )
293- ->willReturnCallback (function ($ configPath ) {
300+ ->willReturnCallback (function ($ configPath ) use ( $ saveMethod ) {
294301 switch ($ configPath ) {
295302 case Config::PARAM_SESSION_SAVE_METHOD :
296- return ' db ' ;
303+ return $ saveMethod ;
297304 case Config::PARAM_SESSION_CACHE_LIMITER :
298305 return 'private_no_expire ' ;
299306 case Config::PARAM_SESSION_SAVE_PATH :
@@ -313,13 +320,13 @@ public function testConstructor()
313320 'sessionConfig ' => $ sessionConfig ,
314321 ]
315322 );
316- $ this ->assertEquals (' db ' , $ sessionConfig ->getOption ('session.save_handler ' ));
323+ $ this ->assertEquals ($ saveMethod , $ sessionConfig ->getOption ('session.save_handler ' ));
317324 $ this ->assertEquals ('private_no_expire ' , $ sessionConfig ->getOption ('session.cache_limiter ' ));
318325 $ this ->assertEquals ('explicit_save_path ' , $ sessionConfig ->getOption ('session.save_path ' ));
319326 $ this ->assertArrayHasKey ('session.use_only_cookies ' , self ::$ isIniSetInvoked );
320327 $ this ->assertEquals ('1 ' , self ::$ isIniSetInvoked ['session.use_only_cookies ' ]);
321328 foreach ($ sessionConfig ->getOptions () as $ option => $ value ) {
322- if ($ option== 'session.save_handler ' ) {
329+ if ($ option === 'session.save_handler ' && $ value !== ' memcached ' ) {
323330 $ this ->assertArrayNotHasKey ('session.save_handler ' , self ::$ isIniSetInvoked );
324331 } else {
325332 $ this ->assertArrayHasKey ($ option , self ::$ isIniSetInvoked );
@@ -329,6 +336,19 @@ public function testConstructor()
329336 $ this ->assertTrue (self ::$ isSessionSetSaveHandlerInvoked );
330337 }
331338
339+ /**
340+ * @return array
341+ */
342+ public function dataConstructor (): array
343+ {
344+ return [
345+ [Config::PARAM_SESSION_SAVE_METHOD =>'db ' ],
346+ [Config::PARAM_SESSION_SAVE_METHOD =>'redis ' ],
347+ [Config::PARAM_SESSION_SAVE_METHOD =>'memcached ' ],
348+ [Config::PARAM_SESSION_SAVE_METHOD =>'user ' ],
349+ ];
350+ }
351+
332352 private function initializeModel (): void
333353 {
334354 $ this ->model = $ this ->objectManager ->create (
0 commit comments