1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From 27d5ba5c13cb4a576400f534057b69231190ac9d Mon Sep 17 00:00:00 2001
From: webimpress <contact@webimpress.com>
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 = "<?php\n";
$expected .= "return array(\n";
@@ -50,9 +60,7 @@ public function testRender()
$expected .= " 1 => '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";
|