Skip to content

Commit 25868f6

Browse files
committed
MC-28948: Doesn't work: "Files" as fallback when Magento fails to connect to "Redis"
1 parent 2383e4b commit 25868f6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

dev/tests/integration/testsuite/Magento/Framework/Session/SaveHandlerTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,38 @@ protected function tearDown()
5555
$this->objectManager->removeSharedInstance(SaveHandlerFactory::class);
5656
}
5757

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+
5890
/**
5991
* @return void
6092
*/

0 commit comments

Comments
 (0)