Skip to content

Commit c8dc423

Browse files
author
lestare
committed
Merge branch 'MAGETWO-59564' into 2.0-develop-pr1
2 parents 061a7f7 + b2b8ace commit c8dc423

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

setup/src/Magento/Setup/Model/ConfigGenerator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ public function createXFrameConfig()
237237
public function createModeConfig()
238238
{
239239
$configData = new ConfigData(ConfigFilePool::APP_ENV);
240-
$configData->set(State::PARAM_MODE, State::MODE_DEFAULT);
240+
if ($this->deploymentConfig->get(State::PARAM_MODE) === null) {
241+
$configData->set(State::PARAM_MODE, State::MODE_DEFAULT);
242+
}
243+
241244
return $configData;
242245
}
243246

setup/src/Magento/Setup/Test/Unit/Model/ConfigGeneratorTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99

1010
use Magento\Framework\Config\ConfigOptionsListConstants;
11+
use Magento\Framework\App\State;
1112

1213
class ConfigGeneratorTest extends \PHPUnit_Framework_TestCase
1314
{
@@ -58,4 +59,24 @@ public function testCreateCacheHostsConfig()
5859
$configData = $this->model->createCacheHostsConfig($data);
5960
$this->assertEquals($expectedData, $configData->getData()[ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS]);
6061
}
62+
63+
public function testCreateModeConfig()
64+
{
65+
$this->deploymentConfigMock->expects($this->once())
66+
->method('get')
67+
->with(State::PARAM_MODE)
68+
->willReturn(null);
69+
$configData = $this->model->createModeConfig();
70+
$this->assertSame(State::MODE_DEFAULT, $configData->getData()[State::PARAM_MODE]);
71+
}
72+
73+
public function testCreateModeConfigIfAlreadySet()
74+
{
75+
$this->deploymentConfigMock->expects($this->once())
76+
->method('get')
77+
->with(State::PARAM_MODE)
78+
->willReturn(State::MODE_PRODUCTION);
79+
$configData = $this->model->createModeConfig();
80+
$this->assertSame([], $configData->getData());
81+
}
6182
}

0 commit comments

Comments
 (0)