|
12 | 12 |
|
13 | 13 | use Magento\Framework\App\DeploymentConfig;
|
14 | 14 | use Magento\Framework\App\State;
|
15 |
| - use Magento\Framework\Session\Config\ConfigInterface; |
16 | 15 |
|
17 | 16 | // @codingStandardsIgnoreEnd
|
18 | 17 |
|
@@ -124,21 +123,6 @@ protected function setUp()
|
124 | 123 | ini_set('session.name', $this->sessionName);
|
125 | 124 |
|
126 | 125 | $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
|
127 |
| - $deploymentConfigMock = $this->createMock(DeploymentConfig::class); |
128 |
| - $deploymentConfigMock->method('get') |
129 |
| - ->willReturnCallback(function ($configPath) { |
130 |
| - switch ($configPath) { |
131 |
| - case Config::PARAM_SESSION_SAVE_METHOD: |
132 |
| - return 'db'; |
133 |
| - case Config::PARAM_SESSION_CACHE_LIMITER: |
134 |
| - return 'private_no_expire'; |
135 |
| - case Config::PARAM_SESSION_SAVE_PATH: |
136 |
| - return 'explicit_save_path'; |
137 |
| - default: |
138 |
| - return null; |
139 |
| - } |
140 |
| - }); |
141 |
| - $this->objectManager->addSharedInstance($deploymentConfigMock, DeploymentConfig::class); |
142 | 126 |
|
143 | 127 | /** @var \Magento\Framework\Session\SidResolverInterface $sidResolver */
|
144 | 128 | $this->appState = $this->getMockBuilder(State::class)
|
@@ -167,7 +151,6 @@ protected function tearDown()
|
167 | 151 | $this->model->destroy();
|
168 | 152 | $this->model = null;
|
169 | 153 | }
|
170 |
| - $this->objectManager->removeSharedInstance(DeploymentConfig::class); |
171 | 154 | }
|
172 | 155 |
|
173 | 156 | public function testSessionNameFromIni()
|
@@ -321,13 +304,32 @@ public function testConstructor()
|
321 | 304 | {
|
322 | 305 | global $mockPHPFunctions;
|
323 | 306 | $mockPHPFunctions = true;
|
| 307 | + |
| 308 | + $deploymentConfigMock = $this->createMock(DeploymentConfig::class); |
| 309 | + $deploymentConfigMock->method('get') |
| 310 | + ->willReturnCallback(function ($configPath) { |
| 311 | + switch ($configPath) { |
| 312 | + case Config::PARAM_SESSION_SAVE_METHOD: |
| 313 | + return 'db'; |
| 314 | + case Config::PARAM_SESSION_CACHE_LIMITER: |
| 315 | + return 'private_no_expire'; |
| 316 | + case Config::PARAM_SESSION_SAVE_PATH: |
| 317 | + return 'explicit_save_path'; |
| 318 | + default: |
| 319 | + return null; |
| 320 | + } |
| 321 | + }); |
| 322 | + $sessionConfig = $this->objectManager->create(Config::class, ['deploymentConfig' => $deploymentConfigMock]); |
| 323 | + $saveHandler = $this->objectManager->create(SaveHandler::class, ['sessionConfig' => $sessionConfig]); |
| 324 | + |
324 | 325 | $this->model = $this->objectManager->create(
|
325 | 326 | \Magento\Framework\Session\SessionManager::class,
|
326 | 327 | [
|
327 |
| - 'sidResolver' => $this->sidResolver |
| 328 | + 'sidResolver' => $this->sidResolver, |
| 329 | + 'saveHandler' => $saveHandler, |
| 330 | + 'sessionConfig' => $sessionConfig, |
328 | 331 | ]
|
329 | 332 | );
|
330 |
| - $sessionConfig = $this->objectManager->get(ConfigInterface::class); |
331 | 333 | $this->assertEquals('db', $sessionConfig->getOption('session.save_handler'));
|
332 | 334 | $this->assertEquals('private_no_expire', $sessionConfig->getOption('session.cache_limiter'));
|
333 | 335 | $this->assertEquals('explicit_save_path', $sessionConfig->getOption('session.save_path'));
|
|
0 commit comments