Annotation of embedaddon/php/ext/date/tests/date_sunset_variation1.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test date_sunset() function : usage variation - Passing unexpected values to first argument time.
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]])
        !             6:  * Description: Returns time of sunset for a given day and location 
        !             7:  * Source code: ext/date/php_date.c
        !             8:  * Alias to functions: 
        !             9:  */
        !            10: 
        !            11: echo "*** Testing date_sunset() : usage variation ***\n";
        !            12: 
        !            13: //Initialise the variables
        !            14: $latitude = 38.4;
        !            15: $longitude = -9;
        !            16: $zenith = 90;
        !            17: $gmt_offset = 1;
        !            18: date_default_timezone_set("Asia/Calcutta");
        !            19: 
        !            20: //get an unset variable
        !            21: $unset_var = 10;
        !            22: unset ($unset_var);
        !            23: 
        !            24: // define some classes
        !            25: class classWithToString
        !            26: {
        !            27:        public function __toString() {
        !            28:                return "Class A object";
        !            29:        }
        !            30: }
        !            31: 
        !            32: class classWithoutToString
        !            33: {
        !            34: }
        !            35: 
        !            36: // heredoc string
        !            37: $heredoc = <<<EOT
        !            38: hello world
        !            39: EOT;
        !            40: 
        !            41: // add arrays
        !            42: $index_array = array (1, 2, 3);
        !            43: $assoc_array = array ('one' => 1, 'two' => 2);
        !            44: 
        !            45: //array of values to iterate over
        !            46: $inputs = array(
        !            47: 
        !            48:       // int data
        !            49:       'int 0' => 0,
        !            50:       'int 1' => 1,
        !            51:       'int 12345' => 12345,
        !            52:       'int -12345' => -2345,
        !            53: 
        !            54:       // float data
        !            55:       'float 10.5' => 10.5,
        !            56:       'float -10.5' => -10.5,
        !            57:       'float .5' => .5,
        !            58: 
        !            59:       // array data
        !            60:       'empty array' => array(),
        !            61:       'int indexed array' => $index_array,
        !            62:       'associative array' => $assoc_array,
        !            63:       'nested arrays' => array('foo', $index_array, $assoc_array),
        !            64: 
        !            65:       // null data
        !            66:       'uppercase NULL' => NULL,
        !            67:       'lowercase null' => null,
        !            68: 
        !            69:       // boolean data
        !            70:       'lowercase true' => true,
        !            71:       'lowercase false' =>false,
        !            72:       'uppercase TRUE' =>TRUE,
        !            73:       'uppercase FALSE' =>FALSE,
        !            74: 
        !            75:       // empty data
        !            76:       'empty string DQ' => "",
        !            77:       'empty string SQ' => '',
        !            78: 
        !            79:       // string data
        !            80:       'string DQ' => "string",
        !            81:       'string SQ' => 'string',
        !            82:       'mixed case string' => "sTrInG",
        !            83:       'heredoc' => $heredoc,
        !            84: 
        !            85:       // object data
        !            86:       'instance of classWithToString' => new classWithToString(),
        !            87:       'instance of classWithoutToString' => new classWithoutToString(),
        !            88: 
        !            89:       // undefined data
        !            90:       'undefined var' => @$undefined_var,
        !            91: 
        !            92:       // unset data
        !            93:       'unset var' => @$unset_var,
        !            94: );
        !            95: 
        !            96: // loop through each element of the array for time
        !            97: 
        !            98: foreach($inputs as $key =>$value) {
        !            99:       echo "\n--$key--\n";
        !           100:       var_dump( date_sunset($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) );
        !           101:       var_dump( date_sunset($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) );
        !           102:       var_dump( date_sunset($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) );
        !           103: };
        !           104: 
        !           105: ?>
        !           106: ===DONE===
        !           107: --EXPECTF--
        !           108: *** Testing date_sunset() : usage variation ***
        !           109: 
        !           110: --int 0--
        !           111: string(5) "18:22"
        !           112: float(18.377%d)
        !           113: int(62558)
        !           114: 
        !           115: --int 1--
        !           116: string(5) "18:22"
        !           117: float(18.377%d)
        !           118: int(62558)
        !           119: 
        !           120: --int 12345--
        !           121: string(5) "18:22"
        !           122: float(18.377%d)
        !           123: int(62558)
        !           124: 
        !           125: --int -12345--
        !           126: string(5) "18:22"
        !           127: float(18.377%d)
        !           128: int(62558)
        !           129: 
        !           130: --float 10.5--
        !           131: string(5) "18:22"
        !           132: float(18.377%d)
        !           133: int(62558)
        !           134: 
        !           135: --float -10.5--
        !           136: string(5) "18:22"
        !           137: float(18.377%d)
        !           138: int(62558)
        !           139: 
        !           140: --float .5--
        !           141: string(5) "18:22"
        !           142: float(18.377%d)
        !           143: int(62558)
        !           144: 
        !           145: --empty array--
        !           146: 
        !           147: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           148: bool(false)
        !           149: 
        !           150: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           151: bool(false)
        !           152: 
        !           153: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           154: bool(false)
        !           155: 
        !           156: --int indexed array--
        !           157: 
        !           158: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           159: bool(false)
        !           160: 
        !           161: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           162: bool(false)
        !           163: 
        !           164: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           165: bool(false)
        !           166: 
        !           167: --associative array--
        !           168: 
        !           169: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           170: bool(false)
        !           171: 
        !           172: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           173: bool(false)
        !           174: 
        !           175: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           176: bool(false)
        !           177: 
        !           178: --nested arrays--
        !           179: 
        !           180: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           181: bool(false)
        !           182: 
        !           183: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           184: bool(false)
        !           185: 
        !           186: Warning: date_sunset() expects parameter 1 to be long, array given in %s on line %d
        !           187: bool(false)
        !           188: 
        !           189: --uppercase NULL--
        !           190: string(5) "18:22"
        !           191: float(18.377%d)
        !           192: int(62558)
        !           193: 
        !           194: --lowercase null--
        !           195: string(5) "18:22"
        !           196: float(18.377%d)
        !           197: int(62558)
        !           198: 
        !           199: --lowercase true--
        !           200: string(5) "18:22"
        !           201: float(18.377%d)
        !           202: int(62558)
        !           203: 
        !           204: --lowercase false--
        !           205: string(5) "18:22"
        !           206: float(18.377%d)
        !           207: int(62558)
        !           208: 
        !           209: --uppercase TRUE--
        !           210: string(5) "18:22"
        !           211: float(18.377%d)
        !           212: int(62558)
        !           213: 
        !           214: --uppercase FALSE--
        !           215: string(5) "18:22"
        !           216: float(18.377%d)
        !           217: int(62558)
        !           218: 
        !           219: --empty string DQ--
        !           220: 
        !           221: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           222: bool(false)
        !           223: 
        !           224: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           225: bool(false)
        !           226: 
        !           227: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           228: bool(false)
        !           229: 
        !           230: --empty string SQ--
        !           231: 
        !           232: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           233: bool(false)
        !           234: 
        !           235: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           236: bool(false)
        !           237: 
        !           238: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           239: bool(false)
        !           240: 
        !           241: --string DQ--
        !           242: 
        !           243: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           244: bool(false)
        !           245: 
        !           246: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           247: bool(false)
        !           248: 
        !           249: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           250: bool(false)
        !           251: 
        !           252: --string SQ--
        !           253: 
        !           254: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           255: bool(false)
        !           256: 
        !           257: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           258: bool(false)
        !           259: 
        !           260: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           261: bool(false)
        !           262: 
        !           263: --mixed case string--
        !           264: 
        !           265: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           266: bool(false)
        !           267: 
        !           268: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           269: bool(false)
        !           270: 
        !           271: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           272: bool(false)
        !           273: 
        !           274: --heredoc--
        !           275: 
        !           276: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           277: bool(false)
        !           278: 
        !           279: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           280: bool(false)
        !           281: 
        !           282: Warning: date_sunset() expects parameter 1 to be long, string given in %s on line %d
        !           283: bool(false)
        !           284: 
        !           285: --instance of classWithToString--
        !           286: 
        !           287: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           288: bool(false)
        !           289: 
        !           290: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           291: bool(false)
        !           292: 
        !           293: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           294: bool(false)
        !           295: 
        !           296: --instance of classWithoutToString--
        !           297: 
        !           298: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           299: bool(false)
        !           300: 
        !           301: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           302: bool(false)
        !           303: 
        !           304: Warning: date_sunset() expects parameter 1 to be long, object given in %s on line %d
        !           305: bool(false)
        !           306: 
        !           307: --undefined var--
        !           308: string(5) "18:22"
        !           309: float(18.377%d)
        !           310: int(62558)
        !           311: 
        !           312: --unset var--
        !           313: string(5) "18:22"
        !           314: float(18.377%d)
        !           315: int(62558)
        !           316: ===DONE===

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