timezone_transitions_get_variation1.phpt 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. --TEST--
  2. Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $object.
  3. --FILE--
  4. <?php
  5. /* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] )
  6. * Description: Returns all transitions for the timezone
  7. * Source code: ext/date/php_date.c
  8. * Alias to functions: DateTimeZone::getTransitions()
  9. */
  10. echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$object***\n";
  11. //Set the default time zone
  12. date_default_timezone_set("Europe/London");
  13. //get an unset variable
  14. $unset_var = 10;
  15. unset ($unset_var);
  16. // define some classes
  17. class classWithToString
  18. {
  19. public function __toString() {
  20. return "Class A object";
  21. }
  22. }
  23. class classWithoutToString
  24. {
  25. }
  26. // heredoc string
  27. $heredoc = <<<EOT
  28. hello world
  29. EOT;
  30. // add arrays
  31. $index_array = array (1, 2, 3);
  32. $assoc_array = array ('one' => 1, 'two' => 2);
  33. // resource
  34. $file_handle = fopen(__FILE__, 'r');
  35. //array of values to iterate over
  36. $inputs = array(
  37. // int data
  38. 'int 0' => 0,
  39. 'int 1' => 1,
  40. 'int 12345' => 12345,
  41. 'int -12345' => -12345,
  42. // float data
  43. 'float 10.5' => 10.5,
  44. 'float -10.5' => -10.5,
  45. 'float .5' => .5,
  46. // array data
  47. 'empty array' => array(),
  48. 'int indexed array' => $index_array,
  49. 'associative array' => $assoc_array,
  50. 'nested arrays' => array('foo', $index_array, $assoc_array),
  51. // null data
  52. 'uppercase NULL' => NULL,
  53. 'lowercase null' => null,
  54. // boolean data
  55. 'lowercase true' => true,
  56. 'lowercase false' =>false,
  57. 'uppercase TRUE' =>TRUE,
  58. 'uppercase FALSE' =>FALSE,
  59. // empty data
  60. 'empty string DQ' => "",
  61. 'empty string SQ' => '',
  62. // string data
  63. 'string DQ' => "string",
  64. 'string SQ' => 'string',
  65. 'mixed case string' => "sTrInG",
  66. 'heredoc' => $heredoc,
  67. // object data
  68. 'instance of classWithToString' => new classWithToString(),
  69. 'instance of classWithoutToString' => new classWithoutToString(),
  70. // undefined data
  71. 'undefined var' => @$undefined_var,
  72. // unset data
  73. 'unset var' => @$unset_var,
  74. // resource
  75. 'resource' => $file_handle
  76. );
  77. foreach($inputs as $variation =>$object) {
  78. echo "\n-- $variation --\n";
  79. var_dump( timezone_transitions_get($object) );
  80. };
  81. // closing the resource
  82. fclose( $file_handle );
  83. ?>
  84. ===DONE===
  85. --EXPECTF--
  86. *** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $object***
  87. -- int 0 --
  88. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
  89. bool(false)
  90. -- int 1 --
  91. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
  92. bool(false)
  93. -- int 12345 --
  94. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
  95. bool(false)
  96. -- int -12345 --
  97. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d
  98. bool(false)
  99. -- float 10.5 --
  100. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
  101. bool(false)
  102. -- float -10.5 --
  103. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
  104. bool(false)
  105. -- float .5 --
  106. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d
  107. bool(false)
  108. -- empty array --
  109. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
  110. bool(false)
  111. -- int indexed array --
  112. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
  113. bool(false)
  114. -- associative array --
  115. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
  116. bool(false)
  117. -- nested arrays --
  118. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d
  119. bool(false)
  120. -- uppercase NULL --
  121. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
  122. bool(false)
  123. -- lowercase null --
  124. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
  125. bool(false)
  126. -- lowercase true --
  127. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
  128. bool(false)
  129. -- lowercase false --
  130. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
  131. bool(false)
  132. -- uppercase TRUE --
  133. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
  134. bool(false)
  135. -- uppercase FALSE --
  136. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d
  137. bool(false)
  138. -- empty string DQ --
  139. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  140. bool(false)
  141. -- empty string SQ --
  142. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  143. bool(false)
  144. -- string DQ --
  145. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  146. bool(false)
  147. -- string SQ --
  148. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  149. bool(false)
  150. -- mixed case string --
  151. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  152. bool(false)
  153. -- heredoc --
  154. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d
  155. bool(false)
  156. -- instance of classWithToString --
  157. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
  158. bool(false)
  159. -- instance of classWithoutToString --
  160. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d
  161. bool(false)
  162. -- undefined var --
  163. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
  164. bool(false)
  165. -- unset var --
  166. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d
  167. bool(false)
  168. -- resource --
  169. Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d
  170. bool(false)
  171. ===DONE===