1--TEST-- 2IntlCalendar::fromDateTime(): errors 3--SKIPIF-- 4<?php 5if (!extension_loaded('intl')) 6 die('skip intl extension not enabled'); 7--FILE-- 8<?php 9ini_set("intl.error_level", E_WARNING); 10ini_set("intl.default_locale", "nl"); 11date_default_timezone_set('Europe/Lisbon'); 12 13var_dump(IntlCalendar::fromDateTime()); 14var_dump(IntlCalendar::fromDateTime(0,1,2)); 15 16try { 17IntlCalendar::fromDateTime("foobar"); 18} catch (Exception $e) { 19 echo "threw exception, OK"; 20} 21class A extends DateTime { 22function __construct() {} 23} 24 25var_dump(IntlCalendar::fromDateTime(new A)); 26 27$date = new DateTime('2012-01-01 00:00:00 +24:00'); 28var_dump(IntlCalendar::fromDateTime($date)); 29 30$date = new DateTime('2012-01-01 00:00:00 WEST'); 31var_dump(IntlCalendar::fromDateTime($date)); 32 33var_dump(intlcal_from_date_time()); 34--EXPECTF-- 35Warning: IntlCalendar::fromDateTime() expects at least 1 parameter, 0 given in %s on line %d 36 37Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d 38NULL 39 40Warning: IntlCalendar::fromDateTime() expects at most 2 parameters, 3 given in %s on line %d 41 42Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: bad arguments in %s on line %d 43NULL 44threw exception, OK 45Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: DateTime object is unconstructed in %s on line %d 46NULL 47 48Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: object has an time zone offset that's too large in %s on line %d 49NULL 50 51Warning: IntlCalendar::fromDateTime(): intlcal_from_date_time: time zone id 'WEST' extracted from ext/date DateTimeZone not recognized in %s on line %d 52NULL 53 54Warning: intlcal_from_date_time() expects at least 1 parameter, 0 given in %s on line %d 55 56Warning: intlcal_from_date_time(): intlcal_from_date_time: bad arguments in %s on line %d 57NULL 58