From ae18f8c8ca84f764cf122aeddd36f4b2eb8e39f4 Mon Sep 17 00:00:00 2001 From: Spagr Date: Tue, 5 Sep 2017 16:48:22 +0200 Subject: [PATCH] The accepts zone in +HH00 format (#3) --- src/XmlRpc/xml-rpc.rng | 2 +- tests/XmlRpc/Coder.dateTime.phpt | 7 +++++++ tests/XmlRpc/files/Coder.dateTime.xml | 17 ++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/XmlRpc/xml-rpc.rng b/src/XmlRpc/xml-rpc.rng index 7da3cac..3a192c9 100644 --- a/src/XmlRpc/xml-rpc.rng +++ b/src/XmlRpc/xml-rpc.rng @@ -86,7 +86,7 @@ - [0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z? + [0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}([+-]\d\d:?\d\d|Z)? diff --git a/tests/XmlRpc/Coder.dateTime.phpt b/tests/XmlRpc/Coder.dateTime.phpt index 58c0a0d..c8a842a 100644 --- a/tests/XmlRpc/Coder.dateTime.phpt +++ b/tests/XmlRpc/Coder.dateTime.phpt @@ -22,8 +22,15 @@ $doc->loadXML($xml); $var = $coder->decodeValueNode($doc->documentElement); Assert::equal([ DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00 +02:30'), + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00 -02:30'), DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-20 12:30:00'), + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00 +02:30'), + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00 -02:30'), DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-20 12:30:00'), + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00 Z'), + + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00+0200'), + DateTime::createFromFormat('Y-m-d H:i:s P', '2000-01-20 12:30:00-0200'), ], $var); diff --git a/tests/XmlRpc/files/Coder.dateTime.xml b/tests/XmlRpc/files/Coder.dateTime.xml index cb28b63..9b58e10 100644 --- a/tests/XmlRpc/files/Coder.dateTime.xml +++ b/tests/XmlRpc/files/Coder.dateTime.xml @@ -4,18 +4,33 @@ 2000-01-20T12:30:00+02:30 + + 2000-01-20T12:30:00-02:30 + 2000-01-20T12:30:00 + 20000120T12:30:00+02:30 - 20000120T12:30:00 + 20000120T12:30:00-02:30 + 20000120T12:30:00 + + + 20000120T12:30:00Z + + + 20000120T12:30:00+0200 + + + 20000120T12:30:00-0200 + \ No newline at end of file