Annotation of embedaddon/php/ext/date/tests/strftime_variation21.phpt, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>