From a78cc640107c579780456371c15530573e024e96 Mon Sep 17 00:00:00 2001 From: Ronan Giron Date: Wed, 14 Apr 2021 22:42:33 +0200 Subject: [PATCH] Fix test --- tests/ConfigTest.php | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index d711dab..2340655 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -115,6 +115,40 @@ public function testHas() } public function testGetArrayCopy() + { + $config = new FakeConfig( + [ + new JsonAdapter(__DIR__ . '/config.json5', true, priority: 0), + new JsonAdapter(__DIR__ . '/config3.json5', true, priority: 10), + new JsonAdapter(__DIR__ . '/config2.json5', true, priority: 1), + ], + variables: ['QUX' => 'QUX QUX QUX'] + ); + $array = [ + "foo" => "ERASE ARRAY", + "bar" => ["ERASE STRING"], + "qux" => "QUX VALUE", + "section" => [ + "foo" => "value", + "qux" => [ + "{var:QUX}", + "{= QUX}", + "value2", + "{not}", + ] + ], + "section2" => [ + "bar" => "{config:section.foo}-test", + "baz" => 123456, + "qux" => "{config:section2.baz}", + ], + "baz" => true + ]; + + $this->assertEquals($array, $config->getArrayCopy()); + } + + public function testGetArrayCopy_compiled() { $config = new FakeConfig( [ @@ -145,6 +179,6 @@ public function testGetArrayCopy() "baz" => true ]; - $this->assertEquals($array, $config->getArrayCopy()); + $this->assertEquals($array, $config->getArrayCopy(true)); } }