1--TEST-- 2Tests for DateTimeImmutable::createFromMutable 3--INI-- 4date.timezone=Europe/London 5--FILE-- 6<?php 7$current = "2014-03-02 16:24:08"; 8 9$i = DateTimeImmutable::createFromMutable( date_create( $current ) ); 10var_dump( $i ); 11 12try { 13 DateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); 14} catch (TypeError $e) { 15 echo $e->getMessage(), "\n"; 16} 17?> 18--EXPECTF-- 19object(DateTimeImmutable)#%d (3) { 20 ["date"]=> 21 string(26) "2014-03-02 16:24:08.000000" 22 ["timezone_type"]=> 23 int(3) 24 ["timezone"]=> 25 string(13) "Europe/London" 26} 27DateTimeImmutable::createFromMutable(): Argument #1 ($object) must be of type DateTime, DateTimeImmutable given 28