Skip to content

Commit 93a381b

Browse files
committed
MC-5926: Conflict of simultaneous write in Redis cache
- integration test to switch from dev to production mode regardless if the integration test framework works in developer or production mode
1 parent e3f12c5 commit 93a381b

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/SetModeCommandTest.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@ protected function setUp()
7878
$this->prevMode = $this->objectManager->get(State::class)->getMode();
7979
$this->filesystem = $this->objectManager->get(Filesystem::class);
8080

81-
$this->config = $this->loadConfig();
82-
$this->envConfig = $this->loadEnvConfig();
81+
// Load the original config to restore it on teardown
82+
$this->config = $this->reader->load(ConfigFilePool::APP_CONFIG);
83+
$this->envConfig = $this->reader->load(ConfigFilePool::APP_ENV);
8384
}
8485

8586
/**
8687
* @inheritdoc
8788
*/
8889
public function tearDown()
8990
{
91+
// Restore the original config
9092
$this->writer->saveConfig([ConfigFilePool::APP_CONFIG => $this->config]);
9193
$this->writer->saveConfig([ConfigFilePool::APP_ENV => $this->envConfig]);
9294

@@ -128,9 +130,14 @@ public function testSwitchMode()
128130
}
129131
}
130132

133+
/**
134+
* Enable production mode
135+
*
136+
* @return void
137+
*/
131138
private function enableAndAssertProductionMode()
132139
{
133-
// enable production mode
140+
// Enable production mode
134141
$this->clearStaticFiles();
135142
$this->commandTester = new CommandTester($this->getStaticContentDeployCommand());
136143
$this->commandTester->execute(
@@ -149,7 +156,9 @@ private function enableAndAssertProductionMode()
149156
}
150157

151158
/**
152-
* Enable
159+
* Enable developer mode
160+
*
161+
* @return void
153162
*/
154163
private function enableAndAssertDeveloperMode()
155164
{
@@ -199,20 +208,4 @@ function ($output) use ($objectManager) {
199208

200209
return $deployStaticContentCommand;
201210
}
202-
203-
/**
204-
* @return array
205-
*/
206-
private function loadConfig()
207-
{
208-
return $this->reader->load(ConfigFilePool::APP_CONFIG);
209-
}
210-
211-
/**
212-
* @return array
213-
*/
214-
private function loadEnvConfig()
215-
{
216-
return $this->reader->load(ConfigFilePool::APP_ENV);
217-
}
218211
}

0 commit comments

Comments
 (0)