Skip to content

Commit 79728d0

Browse files
committed
ACP2E-2198: added unit test
1 parent ae49028 commit 79728d0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,27 @@ public function testEnvVariablesSubstitution(): void
300300
$this->assertSame('D', $this->deploymentConfig->get('b'), 'return value from env');
301301
$this->assertSame('e$%^&', $this->deploymentConfig->get('c'), 'return default value');
302302
}
303+
304+
/**
305+
* @return void
306+
* @throws FileSystemException
307+
* @throws RuntimeException
308+
*/
309+
public function testReloadDataOnMissingConfig(): void {
310+
$this->readerMock->expects($this->exactly(2))->method('load')->willReturnOnConsecutiveCalls(['db' => ['connection' => ['default' => ['host' => 'localhost']]]], [], []);
311+
$connectionConfig1 = $this->deploymentConfig->get(
312+
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . 'default'
313+
);
314+
$this->assertArrayHasKey('host', $connectionConfig1);
315+
$connectionConfig2 = $this->deploymentConfig->get(
316+
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/' . 'default'
317+
);
318+
$this->assertArrayHasKey('host', $connectionConfig2);
319+
$result1 = $this->deploymentConfig->get('missing/key');
320+
$this->assertNull($result1);
321+
$result2 = $this->deploymentConfig->get('missing/key');
322+
$this->assertNull($result2);
323+
$result3 = $this->deploymentConfig->get('missing/key');
324+
$this->assertNull($result3);
325+
}
303326
}

0 commit comments

Comments
 (0)