blob: ccbbe33f1786ce577848700e0bc41930c697603d (
plain)
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
|
--TEST--
Tests for inherited DateTimeImmutable::createFromMutable
--INI--
date.timezone=Europe/London
--FILE--
<?php
class MyDateTimeImmutable extends DateTimeImmutable {}
$current = "2014-03-02 16:24:08";
$i = MyDateTimeImmutable::createFromMutable( date_create( $current ) );
var_dump( $i );
try {
MyDateTimeImmutable::createFromMutable( date_create_immutable( $current ) );
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
object(MyDateTimeImmutable)#%d (3) {
["date"]=>
string(26) "2014-03-02 16:24:08.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/London"
}
DateTimeImmutable::createFromMutable(): Argument #1 ($object) must be of type DateTime, DateTimeImmutable given
|