File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
dev/tests/integration/testsuite/Magento/Framework/Session Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,38 @@ protected function tearDown()
55
55
$ this ->objectManager ->removeSharedInstance (SaveHandlerFactory::class);
56
56
}
57
57
58
+ /**
59
+ * @return void
60
+ */
61
+ public function testRedisSaveHandler (): void
62
+ {
63
+ $ this ->deploymentConfigMock ->method ('get ' )
64
+ ->willReturnMap (
65
+ [
66
+ [Config::PARAM_SESSION_SAVE_METHOD , null , 'redis ' ],
67
+ [Config::PARAM_SESSION_SAVE_PATH , null , 'explicit_save_path ' ],
68
+ ]
69
+ );
70
+
71
+ $ redisHandlerMock = $ this ->getMockBuilder (SaveHandler \Redis::class)
72
+ ->disableOriginalConstructor ()
73
+ ->getMock ();
74
+ $ redisHandlerMock ->method ('open ' )
75
+ ->with ('explicit_save_path ' , 'test_session_id ' )
76
+ ->willReturn (true );
77
+
78
+ $ this ->saveHandlerFactoryMock ->expects ($ this ->exactly (1 ))
79
+ ->method ('create ' )
80
+ ->with ('redis ' )
81
+ ->willReturn ($ redisHandlerMock );
82
+
83
+ $ sessionConfig = $ this ->objectManager ->create (ConfigInterface::class);
84
+ /** @var SaveHandler $saveHandler */
85
+ $ saveHandler = $ this ->objectManager ->create (SaveHandler::class, ['sessionConfig ' => $ sessionConfig ]);
86
+ $ result = $ saveHandler ->open ('explicit_save_path ' , 'test_session_id ' );
87
+ $ this ->assertTrue ($ result );
88
+ }
89
+
58
90
/**
59
91
* @return void
60
92
*/
You can’t perform that action at this time.
0 commit comments