Annotation of embedaddon/php/ext/date/tests/strftime_variation22.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test strftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
! 3: --SKIPIF--
! 4: <?php
! 5: if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
! 6: die("skip Test is not valid for Windows");
! 7: }
! 8: if(!setlocale(LC_ALL, "POSIX")) {
! 9: die("skip Locale POSIX is needed by test and is not available");
! 10: }
! 11: ?>
! 12: --FILE--
! 13: <?php
! 14: /* Prototype : string strftime(string format [, int timestamp])
! 15: * Description: Format a local time/date according to locale settings
! 16: * Source code: ext/date/php_date.c
! 17: * Alias to functions:
! 18: */
! 19:
! 20: echo "*** Testing strftime() : usage variation ***\n";
! 21:
! 22: // Initialise function arguments not being substituted (if any)
! 23: setlocale(LC_ALL, "POSIX");
! 24: putenv("LC_ALL=POSIX");
! 25: date_default_timezone_set("Asia/Calcutta");
! 26: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
! 27:
! 28: //array of values to iterate over
! 29: $inputs = array(
! 30: 'Preferred date and time representation' => "%c",
! 31: 'Preferred date representation' => "%x",
! 32: 'Preferred time representation' => "%X",
! 33: );
! 34:
! 35: // loop through each element of the array for timestamp
! 36:
! 37: foreach($inputs as $key =>$value) {
! 38: echo "\n--$key--\n";
! 39: var_dump( $value );
! 40: var_dump( strftime($value, $timestamp) );
! 41: }
! 42:
! 43: ?>
! 44: ===DONE===
! 45: --EXPECT--
! 46: *** Testing strftime() : usage variation ***
! 47:
! 48: --Preferred date and time representation--
! 49: string(2) "%c"
! 50: string(24) "Fri Aug 8 08:08:08 2008"
! 51:
! 52: --Preferred date representation--
! 53: string(2) "%x"
! 54: string(8) "08/08/08"
! 55:
! 56: --Preferred time representation--
! 57: string(2) "%X"
! 58: string(8) "08:08:08"
! 59: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>