Skip to content

Commit 81dc33e

Browse files
alzotao-iegorov
authored andcommitted
ACP2E-1958: avoid reloading configs for each requested key; added unit tests
1 parent 992ca88 commit 81dc33e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/internal/Magento/Framework/App/DeploymentConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private function getEnvOverride() : array
185185
*/
186186
private function reloadInitialData(): void
187187
{
188-
if (empty($this->readerLoad)) {
188+
if (empty($this->readerLoad) || empty($this->data) || empty($this->flatData)) {
189189
$this->readerLoad = $this->reader->load();
190190
}
191191
$this->data = array_replace(

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function keyCollisionDataProvider(): array
228228
*/
229229
public function testResetData(): void
230230
{
231-
$this->readerMock->expects($this->exactly(1))->method('load')->willReturn(self::$fixture);
231+
$this->readerMock->expects($this->exactly(2))->method('load')->willReturn(self::$fixture);
232232
$this->assertSame(self::$flattenedFixture, $this->deploymentConfig->get());
233233
$this->deploymentConfig->resetData();
234234
// second time to ensure loader will be invoked only once after reset

0 commit comments

Comments
 (0)