xref: /php-src/ext/soap/tests/schema/schema064.phpt (revision 7f2f0c00)
1--TEST--
2SOAP XML Schema 64: standard date/time types
3--EXTENSIONS--
4soap
5xml
6--SKIPIF--
7<?php
8if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
9    die('skip, windows has different TZ format');
10}
11?>
12--FILE--
13<?php
14include "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>
28EOF;
29$date = gmmktime(1,2,3,4,5,1976);
30putenv('TZ=GMT');
31test_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));
41echo "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>
46object(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}
64ok
65