File: yaml_parse_spec_timestamp.phpt

package info (click to toggle)
php-yaml 2.0.2%2B1.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 904 kB
  • sloc: ansic: 4,832; xml: 751; makefile: 1
file content (33 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (13)
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
--TEST--
Yaml 1.1 Spec - timestamp
--SKIPIF--
<?php if(!extension_loaded('yaml')) die('skip yaml n/a'); ?>
--INI--
yaml.decode_timestamp=1
date.timezone=GMT
--FILE--
<?php
  var_dump(yaml_parse('
canonical:         2001-12-15T02:59:43.1Z
valid iso8601:     2001-12-14t21:59:43.10-05:00
alternate iso8601: 2001-12-14T21:59:43.10-0500
space separated:   2001-12-14 21:59:43.10 -5
no time zone (Z):  2001-12-15 2:59:43.10
date (00:00:00Z):  2002-12-14
'));
?>
--EXPECT--
array(6) {
  ["canonical"]=>
  int(1008385183)
  ["valid iso8601"]=>
  int(1008385183)
  ["alternate iso8601"]=>
  int(1008385183)
  ["space separated"]=>
  int(1008385183)
  ["no time zone (Z)"]=>
  int(1008385183)
  ["date (00:00:00Z)"]=>
  int(1039824000)
}