File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,10 @@ public function createXFrameConfig()
237
237
public function createModeConfig ()
238
238
{
239
239
$ 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
+
241
244
return $ configData ;
242
245
}
243
246
Original file line number Diff line number Diff line change 8
8
9
9
10
10
use Magento \Framework \Config \ConfigOptionsListConstants ;
11
+ use Magento \Framework \App \State ;
11
12
12
13
class ConfigGeneratorTest extends \PHPUnit_Framework_TestCase
13
14
{
@@ -58,4 +59,24 @@ public function testCreateCacheHostsConfig()
58
59
$ configData = $ this ->model ->createCacheHostsConfig ($ data );
59
60
$ this ->assertEquals ($ expectedData , $ configData ->getData ()[ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS ]);
60
61
}
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
+ }
61
82
}
You can’t perform that action at this time.
0 commit comments