18 private $arrayManagerMock;
23 private $placeholderMock;
30 protected function setUp()
32 $this->arrayManagerMock = $this->getMockBuilder(ArrayManager::class)
33 ->disableOriginalConstructor()
35 $this->placeholderMock = $this->getMockBuilder(PlaceholderInterface::class)
36 ->getMockForAbstractClass();
39 $placeholderFactoryMock = $this->getMockBuilder(PlaceholderFactory::class)
40 ->disableOriginalConstructor()
42 $placeholderFactoryMock->expects($this->once())
45 ->willReturn($this->placeholderMock);
57 $placeholder =
'CONFIG__UNIT__TEST__VALUE';
58 $configValue =
'test_value';
59 $configPath =
'unit/test/value';
60 $expectedArray = [
'unit' => [
'test' => [
'value' => $configValue]]];
61 $_ENV[$placeholder] = $configValue;
63 $this->placeholderMock->expects($this->any())
64 ->method(
'isApplicable')
68 $this->placeholderMock->expects($this->once())
71 ->willReturn($configPath);
72 $this->arrayManagerMock->expects($this->once())
74 ->with($configPath, [], $configValue)
75 ->willReturn($expectedArray);
77 $this->assertEquals($expectedResult, $this->source->get(
$path));
86 [
'', [
'unit' => [
'test' => [
'value' =>
'test_value']]]],
87 [
'unit', [
'test' => [
'value' =>
'test_value']]],
88 [
'unit/test', [
'value' =>
'test_value']],
89 [
'unit/test/value',
'test_value'],
98 $this->placeholderMock->expects($this->any())
99 ->method(
'isApplicable')
101 $this->placeholderMock->expects($this->never())
103 $this->arrayManagerMock->expects($this->never())
106 $this->assertSame($expectedArray, $this->source->get());
111 unset($_ENV[
'CONFIG__UNIT__TEST__VALUE']);
testGet($path, $expectedResult)
testGetWithoutEnvConfigurationVariables()