xref: /PHP-5.6/ext/date/tests/013.phpt (revision fdb2709d)
1--TEST--
2date_date_set() tests
3--FILE--
4<?php
5date_default_timezone_set('UTC');
6
7$dto = date_create("2006-12-12");
8var_dump($dto);
9var_dump($dto->format("Y.m.d H:i:s"));
10var_dump(date_date_set());
11var_dump($dto->format("Y.m.d H:i:s"));
12var_dump(date_date_set($dto, 2006, 5));
13var_dump($dto->format("Y.m.d H:i:s"));
14var_dump(date_date_set($dto, 2006, 2, 15));
15var_dump($dto->format("Y.m.d H:i:s"));
16var_dump(date_date_set($dto, 2006, 24, 60));
17var_dump($dto->format("Y.m.d H:i:s"));
18
19echo "Done\n";
20?>
21--EXPECTF--
22object(DateTime)#%d (3) {
23  ["date"]=>
24  string(26) "2006-12-12 00:00:00.000000"
25  ["timezone_type"]=>
26  int(3)
27  ["timezone"]=>
28  string(3) "UTC"
29}
30string(19) "2006.12.12 00:00:00"
31
32Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d
33bool(false)
34string(19) "2006.12.12 00:00:00"
35
36Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d
37bool(false)
38string(19) "2006.12.12 00:00:00"
39object(DateTime)#1 (3) {
40  ["date"]=>
41  string(26) "2006-02-15 00:00:00.000000"
42  ["timezone_type"]=>
43  int(3)
44  ["timezone"]=>
45  string(3) "UTC"
46}
47string(19) "2006.02.15 00:00:00"
48object(DateTime)#1 (3) {
49  ["date"]=>
50  string(26) "2008-01-29 00:00:00.000000"
51  ["timezone_type"]=>
52  int(3)
53  ["timezone"]=>
54  string(3) "UTC"
55}
56string(19) "2008.01.29 00:00:00"
57Done
58