make test runner work in open source repo
[hiphop-php.git] / hphp / test / zend / bad / ext-date / date_time_set_variation3.php
blobd1c60f45c940a20e224c072b9689413792040a46
1 <?php
2 /* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] )
3 * Description: Resets the current time of the DateTime object to a different time.
4 * Source code: ext/date/php_date.c
5 * Alias to functions: DateTime::setTime
6 */
8 echo "*** Testing date_time_set() : usage variation - unexpected values to third argument \$minute***\n";
10 //Set the default time zone
11 date_default_timezone_set("Europe/London");
13 //get an unset variable
14 $unset_var = 10;
15 unset ($unset_var);
17 // define some classes
18 class classWithToString
20 public function __toString() {
21 return "Class A object";
25 class classWithoutToString
29 // heredoc string
30 $heredoc = <<<EOT
31 hello world
32 EOT;
34 // add arrays
35 $index_array = array (1, 2, 3);
36 $assoc_array = array ('one' => 1, 'two' => 2);
38 // resource
39 $file_handle = fopen(__FILE__, 'r');
41 //array of values to iterate over
42 $inputs = array(
44 // int data
45 'int 0' => 0,
46 'int 1' => 1,
47 'int 12345' => 12345,
48 'int -12345' => -12345,
50 // float data
51 'float 10.5' => 10.5,
52 'float -10.5' => -10.5,
53 'float .5' => .5,
55 // array data
56 'empty array' => array(),
57 'int indexed array' => $index_array,
58 'associative array' => $assoc_array,
59 'nested arrays' => array('foo', $index_array, $assoc_array),
61 // null data
62 'uppercase NULL' => NULL,
63 'lowercase null' => null,
65 // boolean data
66 'lowercase true' => true,
67 'lowercase false' =>false,
68 'uppercase TRUE' =>TRUE,
69 'uppercase FALSE' =>FALSE,
71 // empty data
72 'empty string DQ' => "",
73 'empty string SQ' => '',
75 // string data
76 'string DQ' => "string",
77 'string SQ' => 'string',
78 'mixed case string' => "sTrInG",
79 'heredoc' => $heredoc,
81 // object data
82 'instance of classWithToString' => new classWithToString(),
83 'instance of classWithoutToString' => new classWithoutToString(),
85 // undefined data
86 'undefined var' => @$undefined_var,
88 // unset data
89 'unset var' => @$unset_var,
91 // resource
92 'resource' => $file_handle
95 $object = date_create("2009-01-31 15:14:10");
96 $hour = 10;
97 $sec = 45;
99 foreach($inputs as $variation =>$minute) {
100 echo "\n-- $variation --\n";
101 var_dump( date_time_set($object, $hour, $minute, $sec) );
104 // closing the resource
105 fclose( $file_handle );
108 ===DONE===