Skip to content

Commit 1ffb236

Browse files
author
Igor Melnikov
committed
MAGETWO-51068: Admin User session expired despite Session Lifetime
Renaming constant
1 parent 252e665 commit 1ffb236

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/internal/Magento/Framework/Session/SaveHandler/Redis/Config.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66
namespace Magento\Framework\Session\SaveHandler\Redis;
77

8-
use Magento\Framework\App\DeploymentConfig;
9-
use Magento\Framework\App\State;
108
use Magento\Framework\App\Config\ScopeConfigInterface;
119
use Magento\Store\Model\ScopeInterface as StoreScopeInterface;
10+
use Magento\Framework\App\DeploymentConfig;
11+
use Magento\Framework\App\State;
1212

1313
/**
1414
* Redis session save handler
@@ -111,9 +111,9 @@ class Config implements \Cm\RedisSession\Handler\ConfigInterface
111111
const XML_PATH_ADMIN_SESSION_LIFETIME = 'admin/security/session_lifetime';
112112

113113
/**
114-
* Max admin session lifetime
114+
* Session max lifetime
115115
*/
116-
const ADMIN_SESSION_MAX_LIFETIME = 31536000;
116+
const SESSION_MAX_LIFETIME = 31536000;
117117

118118
/**
119119
* Deployment config
@@ -227,7 +227,7 @@ public function getMaxConcurrency()
227227
*/
228228
public function getMaxLifetime()
229229
{
230-
return self::ADMIN_SESSION_MAX_LIFETIME;
230+
return self::SESSION_MAX_LIFETIME;
231231
}
232232

233233
/**

lib/internal/Magento/Framework/Session/Test/Unit/SaveHandler/Redis/ConfigTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Framework\Session\Test\Unit\SaveHandler\Redis;
77

8+
use Magento\Store\Model\ScopeInterface;
89
use Magento\Framework\Session\SaveHandler\Redis\Config;
910

1011
class ConfigTest extends \PHPUnit_Framework_TestCase
@@ -25,7 +26,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
2526
private $scopeConfigMock;
2627

2728
/**
28-
* @var \Magento\Framework\Session\SaveHandler\Redis\Config
29+
* @var Config
2930
*/
3031
private $config;
3132

@@ -37,7 +38,7 @@ public function setUp()
3738

3839
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
3940
$this->config = $objectManager->getObject(
40-
\Magento\Framework\Session\SaveHandler\Redis\Config::class,
41+
Config::class,
4142
[
4243
'deploymentConfig' => $this->deploymentConfigMock,
4344
'appState' => $this->appStateMock,
@@ -148,8 +149,7 @@ public function testGetMaxConcurrency()
148149

149150
public function testGetMaxLifetime()
150151
{
151-
$expected = 31536000;
152-
$this->assertEquals($this->config->getMaxLifetime(), $expected);
152+
$this->assertEquals($this->config->getMaxLifetime(), Config::SESSION_MAX_LIFETIME);
153153
}
154154

155155
public function testGetMinLifetime()
@@ -225,7 +225,7 @@ public function testGetLifetimeAdmin()
225225
->willReturn($areaCode);
226226
$this->scopeConfigMock->expects($this->once())
227227
->method('getValue')
228-
->with(\Magento\Framework\Session\SaveHandler\Redis\Config::XML_PATH_ADMIN_SESSION_LIFETIME)
228+
->with(Config::XML_PATH_ADMIN_SESSION_LIFETIME)
229229
->willReturn($expectedLifetime);
230230
$this->assertEquals($this->config->getLifetime(), $expectedLifetime);
231231
}
@@ -240,8 +240,8 @@ public function testGetLifetimeFrontend()
240240
$this->scopeConfigMock->expects($this->once())
241241
->method('getValue')
242242
->with(
243-
\Magento\Framework\Session\SaveHandler\Redis\Config::XML_PATH_COOKIE_LIFETIME,
244-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
243+
Config::XML_PATH_COOKIE_LIFETIME,
244+
ScopeInterface::SCOPE_STORE
245245
)
246246
->willReturn($expectedLifetime);
247247
$this->assertEquals($this->config->getLifetime(), $expectedLifetime);

0 commit comments

Comments
 (0)