Annotation of embedaddon/php/ext/date/tests/DateTime_modify_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test DateTime::modify() function : error conditions
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : public DateTime DateTime::modify ( string $modify )
! 6: * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
! 7: * Source code: ext/date/php_date.c
! 8: * Alias to functions: public date_modify()
! 9: */
! 10:
! 11: //Set the default time zone
! 12: date_default_timezone_set("Europe/London");
! 13:
! 14: echo "*** Testing DateTime::modify() : error conditions ***\n";
! 15:
! 16: // Create a date object
! 17: $object = new DateTime("2009-01-30 19:34:10");
! 18:
! 19: echo "\n-- Testing DateTime::modify() function with less than expected no. of arguments --\n";
! 20: var_dump( $object->modify() );
! 21:
! 22: echo "\n-- Testing DateTime::modify() function with more than expected no. of arguments --\n";
! 23: $modify = "+1 day";
! 24: $extra_arg = 99;
! 25: var_dump( $object->modify($modify, $extra_arg) );
! 26:
! 27: ?>
! 28: ===DONE===
! 29: --EXPECTF--
! 30: *** Testing DateTime::modify() : error conditions ***
! 31:
! 32: -- Testing DateTime::modify() function with less than expected no. of arguments --
! 33:
! 34: Warning: DateTime::modify() expects exactly 1 parameter, 0 given in %s on line %d
! 35: bool(false)
! 36:
! 37: -- Testing DateTime::modify() function with more than expected no. of arguments --
! 38:
! 39: Warning: DateTime::modify() expects exactly 1 parameter, 2 given in %s on line %d
! 40: bool(false)
! 41: ===DONE===
! 42:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>