Annotation of embedaddon/php/ext/date/tests/DateTime_setDate_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test DateTime::setDate() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day )
! 6: * Description: Resets the current date of the DateTime object to a different date.
! 7: * Source code: ext/date/php_date.c
! 8: * Alias to functions: date_date_set()
! 9: */
! 10:
! 11: date_default_timezone_set("Europe/London");
! 12:
! 13: echo "*** Testing DateTime::setDate() : error conditions ***\n";
! 14:
! 15: $datetime = new DateTime("2009-01-30 19:34:10");
! 16:
! 17: echo "\n-- Testing DateTime::setDate() function with zero arguments --\n";
! 18: var_dump( $datetime->setDate() );
! 19:
! 20: echo "\n-- Testing DateTime::setDate() function with less than expected no. of arguments --\n";
! 21: $year = 2009;
! 22: $month = 1;
! 23: $day = 30;
! 24: var_dump( $datetime->setDate($year) );
! 25: var_dump( $datetime->setDate($year, $month) );
! 26:
! 27: echo "\n-- Testing DateTime::setDate() function with more than expected no. of arguments --\n";
! 28: $extra_arg = 10;
! 29: var_dump( $datetime->setDate($year, $month, $day, $extra_arg) );
! 30:
! 31: ?>
! 32: ===DONE===
! 33: --EXPECTF--
! 34: *** Testing DateTime::setDate() : error conditions ***
! 35:
! 36: -- Testing DateTime::setDate() function with zero arguments --
! 37:
! 38: Warning: DateTime::setDate() expects exactly 3 parameters, 0 given in %s on line %d
! 39: bool(false)
! 40:
! 41: -- Testing DateTime::setDate() function with less than expected no. of arguments --
! 42:
! 43: Warning: DateTime::setDate() expects exactly 3 parameters, 1 given in %s on line %d
! 44: bool(false)
! 45:
! 46: Warning: DateTime::setDate() expects exactly 3 parameters, 2 given in %s on line %d
! 47: bool(false)
! 48:
! 49: -- Testing DateTime::setDate() function with more than expected no. of arguments --
! 50:
! 51: Warning: DateTime::setDate() expects exactly 3 parameters, 4 given in %s on line %d
! 52: bool(false)
! 53: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>