1--TEST-- 2IntlCalendar::setTimeZone(): bad arguments 3--INI-- 4date.timezone=Atlantic/Azores 5--SKIPIF-- 6<?php 7if (!extension_loaded('intl')) 8 die('skip intl extension not enabled'); 9--FILE-- 10<?php 11ini_set("intl.error_level", E_WARNING); 12 13$c = new IntlGregorianCalendar(NULL, 'pt_PT'); 14 15$gmt = IntlTimeZone::getGMT(); 16 17function eh($errno, $errstr) { 18echo "error: $errno, $errstr\n"; 19} 20set_error_handler('eh'); 21 22try { 23 var_dump($c->setTimeZone($gmt, 2)); 24} catch (Error $ex) { 25 echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; 26} 27try { 28 var_dump($c->setTimeZone()); 29} catch (Error $ex) { 30 echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; 31} 32 33try{ 34 var_dump(intlcal_set_time_zone($c, 1, 2)); 35} catch (Error $ex) { 36 echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; 37} 38try{ 39 var_dump(intlcal_set_time_zone(1, $gmt)); 40} catch (Error $ex) { 41 echo "error: " . $ex->getCode() . ", " . $ex->getMessage() . "\n\n"; 42} 43 44--EXPECT-- 45error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 2 given 46error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments 47bool(false) 48error: 2, IntlCalendar::setTimeZone() expects exactly 1 parameter, 0 given 49error: 2, IntlCalendar::setTimeZone(): intlcal_set_time_zone: bad arguments 50bool(false) 51error: 2, intlcal_set_time_zone() expects exactly 2 parameters, 3 given 52error: 2, intlcal_set_time_zone(): intlcal_set_time_zone: bad arguments 53bool(false) 54error: 0, Argument 1 passed to intlcal_set_time_zone() must be an instance of IntlCalendar, integer given 55