From 5f7a2c6c08ed2438113fa59484373404ca3335bf Mon Sep 17 00:00:00 2001 From: Maciej Holyszko <14310995+falkenhawk@users.noreply.github.com> Date: Sat, 18 May 2019 23:26:03 +0200 Subject: [PATCH] tests adjustments - fixed tests sensitive to line endings in test files (expected CRLF) - BC Zend_Amf_RequestTest fix from https://github.com/diablomedia/zf1/commit/ba8cf7aaf6542b7aadee79146709302d65e85bdd#diff-68d7be0100c43bc2df55377c9d27cd05 --- tests/Zend/Amf/RequestTest.php | 9 ++++++++- tests/Zend/Http/_files/.gitattributes | 2 ++ tests/Zend/Mail/_files/test.mbox/.gitattributes | 2 ++ tests/Zend/XmlRpc/_files/.gitattributes | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/Zend/Http/_files/.gitattributes create mode 100644 tests/Zend/Mail/_files/test.mbox/.gitattributes create mode 100644 tests/Zend/XmlRpc/_files/.gitattributes diff --git a/tests/Zend/Amf/RequestTest.php b/tests/Zend/Amf/RequestTest.php index f07677c9d..84a6320e6 100644 --- a/tests/Zend/Amf/RequestTest.php +++ b/tests/Zend/Amf/RequestTest.php @@ -433,7 +433,14 @@ public function testAmf0MixedArrayParameterDeserializedToNativePhpObject() $this->assertTrue($bodies[0] instanceof Zend_Amf_Value_MessageBody); $data = $bodies[0]->getData(); // Make sure that the string was deserialized properly and check its value - $this->assertTrue(property_exists($data[0], 1)); + // In PHP versions less than 7, get_object_vars doesn't return numerical + // keys. In PHP 7.2+ array_key_exists on this particular object returns false + // https://3v4l.org/ui8Fm + if (version_compare(PHP_VERSION, '7.0.0', '>=')) { + $this->assertTrue(array_key_exists(1, get_object_vars($data[0]))); + } else { + $this->assertTrue(array_key_exists(1, $data[0])); + } $this->assertEquals('two', $data[0]->two); } diff --git a/tests/Zend/Http/_files/.gitattributes b/tests/Zend/Http/_files/.gitattributes new file mode 100644 index 000000000..921b7da60 --- /dev/null +++ b/tests/Zend/Http/_files/.gitattributes @@ -0,0 +1,2 @@ +response_chunked eol=crlf +response_chunked_case eol=crlf \ No newline at end of file diff --git a/tests/Zend/Mail/_files/test.mbox/.gitattributes b/tests/Zend/Mail/_files/test.mbox/.gitattributes new file mode 100644 index 000000000..8ce26b5e6 --- /dev/null +++ b/tests/Zend/Mail/_files/test.mbox/.gitattributes @@ -0,0 +1,2 @@ +INBOX eol=crlf +subfolder/* eol=crlf \ No newline at end of file diff --git a/tests/Zend/XmlRpc/_files/.gitattributes b/tests/Zend/XmlRpc/_files/.gitattributes new file mode 100644 index 000000000..05dc4894a --- /dev/null +++ b/tests/Zend/XmlRpc/_files/.gitattributes @@ -0,0 +1 @@ +ZF1897-response-chunked.txt eol=crlf \ No newline at end of file