1--TEST--
2Tests for inherited DateTime::createFromImmutable
3--INI--
4date.timezone=Europe/London
5--FILE--
6<?php
7class MyDateTime extends DateTime {}
8
9$current = "2014-03-02 16:24:08";
10$i = date_create_immutable( $current );
11
12$m = MyDateTime::createFromImmutable( $i );
13var_dump( $m );
14
15$m->modify('+ 1 hour');
16
17var_dump( $i->format('Y-m-d H:i:s') === $current );
18
19try {
20    MyDateTime::createFromImmutable( date_create( $current ) );
21} catch (TypeError $e) {
22    echo $e->getMessage(), "\n";
23}
24?>
25--EXPECTF--
26object(MyDateTime)#%d (3) {
27  ["date"]=>
28  string(26) "2014-03-02 16:24:08.000000"
29  ["timezone_type"]=>
30  int(3)
31  ["timezone"]=>
32  string(13) "Europe/London"
33}
34bool(true)
35DateTime::createFromImmutable(): Argument #1 ($object) must be of type DateTimeImmutable, DateTime given
36