Annotation of embedaddon/php/ext/date/tests/checkdate_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test date_create() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : bool checkdate ( int $month , int $day , int $year )
! 6: * Description: Checks the validity of the date formed by the arguments.
! 7: * A date is considered valid if each parameter is properly defined.
! 8: * Source code: ext/date/php_date.c
! 9: */
! 10:
! 11: //Set the default time zone
! 12: date_default_timezone_set("Europe/London");
! 13:
! 14: echo "*** Testing checkdate() : basic functionality ***\n";
! 15:
! 16: echo "-- The following are all valid dates --\n";
! 17: var_dump( checkdate(1, 1, 2009) );
! 18: var_dump( checkdate(12, 31, 2009) );
! 19: var_dump( checkdate(7, 2, 1963) );
! 20: var_dump( checkdate(5, 31, 2009) );
! 21: var_dump( checkdate(2, 28, 2009) ); // non-leap year
! 22: var_dump( checkdate(2, 29, 2008) ); // leap year
! 23: var_dump( checkdate(7, 2, 1) ); // min year
! 24: var_dump( checkdate(7, 2, 32767) ); // max year
! 25:
! 26: echo "-- The following are all invalid dates --\n";
! 27: var_dump( checkdate(13, 1, 2009) );
! 28: var_dump( checkdate(2, 31, 2009) );
! 29: var_dump( checkdate(1, 32, 2009) );
! 30: var_dump( checkdate(2, 29, 2009) ); // non-leap year
! 31: var_dump( checkdate(7, 2, 32768) ); // >max year
! 32: var_dump( checkdate(7, 2, 0) ); // <min year
! 33:
! 34: ?>
! 35: ===DONE===
! 36: --EXPECT--
! 37: *** Testing checkdate() : basic functionality ***
! 38: -- The following are all valid dates --
! 39: bool(true)
! 40: bool(true)
! 41: bool(true)
! 42: bool(true)
! 43: bool(true)
! 44: bool(true)
! 45: bool(true)
! 46: bool(true)
! 47: -- The following are all invalid dates --
! 48: bool(false)
! 49: bool(false)
! 50: bool(false)
! 51: bool(false)
! 52: bool(false)
! 53: bool(false)
! 54: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>