From 27d5ba5c13cb4a576400f534057b69231190ac9d Mon Sep 17 00:00:00 2001 From: webimpress Date: Sun, 16 Dec 2018 12:23:02 +0000 Subject: [PATCH] Fixed expected value in test to work on PHP 7.3 Result of var_export for object has been changed on PHP 7.3 See: https://bugs.php.net/bug.php?id=48016 --- test/Writer/PhpArrayTest.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/Writer/PhpArrayTest.php b/test/Writer/PhpArrayTest.php index e3e0420..df4523e 100644 --- a/test/Writer/PhpArrayTest.php +++ b/test/Writer/PhpArrayTest.php @@ -41,6 +41,16 @@ public function testRender() $configString = $this->writer->toString($config); + $object = "stdClass::__set_state(array(\n" + . " 'foo' => 'bar',\n" + . ')),'; + + if (version_compare(PHP_VERSION, '7.3.0') !== -1) { + $object = '(object) array(' . "\n" + . " 'foo' => 'bar',\n" + . '),'; + } + // build string line by line as we are trailing-whitespace sensitive. $expected = " 'foo',\n"; $expected .= " ),\n"; $expected .= " 'emptyArray' => array(),\n"; - $expected .= " 'object' => stdClass::__set_state(array(\n"; - $expected .= " 'foo' => 'bar',\n"; - $expected .= ")),\n"; + $expected .= " 'object' => " . $object . "\n"; $expected .= " 'integer' => 123,\n"; $expected .= " 'boolean' => false,\n"; $expected .= " 'null' => null,\n";