schema064.phpt 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --TEST--
  2. SOAP XML Schema 64: standard date/time types
  3. --EXTENSIONS--
  4. soap
  5. xml
  6. --SKIPIF--
  7. <?php
  8. if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
  9. die('skip, windows has different TZ format');
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. include "test_schema.inc";
  15. $schema = <<<EOF
  16. <complexType name="testType">
  17. <sequence>
  18. <element name="dateTime" type="dateTime"/>
  19. <element name="time" type="time"/>
  20. <element name="date" type="date"/>
  21. <element name="gYearMonth" type="gYearMonth"/>
  22. <element name="gYear" type="gYear"/>
  23. <element name="gMonthDay" type="gMonthDay"/>
  24. <element name="gDay" type="gDay"/>
  25. <element name="gMonth" type="gMonth"/>
  26. </sequence>
  27. </complexType>
  28. EOF;
  29. $date = gmmktime(1,2,3,4,5,1976);
  30. putenv('TZ=GMT');
  31. test_schema($schema,'type="tns:testType"',array(
  32. 'dateTime' => $date,
  33. 'time' => $date,
  34. 'date' => $date,
  35. 'gYearMonth' => $date,
  36. 'gYear' => $date,
  37. 'gMonthDay' => $date,
  38. 'gDay' => $date,
  39. 'gMonth' => $date
  40. ));
  41. echo "ok";
  42. ?>
  43. --EXPECTF--
  44. <?xml version="1.0" encoding="UTF-8"?>
  45. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test-uri/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test><testParam xsi:type="ns1:testType"><dateTime xsi:type="xsd:dateTime">1976-04-05T01:02:03Z</dateTime><time xsi:type="xsd:time">01:02:03Z</time><date xsi:type="xsd:date">1976-04-05Z</date><gYearMonth xsi:type="xsd:gYearMonth">1976-04Z</gYearMonth><gYear xsi:type="xsd:gYear">1976Z</gYear><gMonthDay xsi:type="xsd:gMonthDay">--04-05Z</gMonthDay><gDay xsi:type="xsd:gDay">---05Z</gDay><gMonth xsi:type="xsd:gMonth">--04--Z</gMonth></testParam></ns1:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
  46. object(stdClass)#%d (8) {
  47. ["dateTime"]=>
  48. string(20) "1976-04-05T01:02:03Z"
  49. ["time"]=>
  50. string(9) "01:02:03Z"
  51. ["date"]=>
  52. string(11) "1976-04-05Z"
  53. ["gYearMonth"]=>
  54. string(8) "1976-04Z"
  55. ["gYear"]=>
  56. string(5) "1976Z"
  57. ["gMonthDay"]=>
  58. string(8) "--04-05Z"
  59. ["gDay"]=>
  60. string(6) "---05Z"
  61. ["gMonth"]=>
  62. string(7) "--04--Z"
  63. }
  64. ok