PageRenderTime 91ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/date/tests/timezone_open_variation1.php

http://github.com/facebook/hiphop-php
PHP | 103 lines | 55 code | 24 blank | 24 comment | 0 complexity | b7a906ac17296f12fccdf87aa9ee1c91 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. /* Prototype : DateTimeZone timezone_open ( string $timezone )
  3. * Description: Returns new DateTimeZone object
  4. * Source code: ext/date/php_date.c
  5. * Alias to functions: DateTime::__construct()
  6. */
  7. echo "*** Testing timezone_open() : usage variation - unexpected values to first argument \$timezone***\n";
  8. //Set the default time zone
  9. date_default_timezone_set("Europe/London");
  10. //get an unset variable
  11. $unset_var = 10;
  12. unset ($unset_var);
  13. // define some classes
  14. class classWithToString
  15. {
  16. public function __toString() {
  17. return "Class A object";
  18. }
  19. }
  20. class classWithoutToString
  21. {
  22. }
  23. // heredoc string
  24. $heredoc = <<<EOT
  25. hello world
  26. EOT;
  27. // add arrays
  28. $index_array = array (1, 2, 3);
  29. $assoc_array = array ('one' => 1, 'two' => 2);
  30. // resource
  31. $file_handle = fopen(__FILE__, 'r');
  32. //array of values to iterate over
  33. $inputs = array(
  34. // int data
  35. 'int 0' => 0,
  36. 'int 1' => 1,
  37. 'int 12345' => 12345,
  38. // float data
  39. 'float 10.5' => 10.5,
  40. 'float .5' => .5,
  41. // array data
  42. 'empty array' => array(),
  43. 'int indexed array' => $index_array,
  44. 'associative array' => $assoc_array,
  45. 'nested arrays' => array('foo', $index_array, $assoc_array),
  46. // null data
  47. 'uppercase NULL' => NULL,
  48. 'lowercase null' => null,
  49. // boolean data
  50. 'lowercase true' => true,
  51. 'lowercase false' =>false,
  52. 'uppercase TRUE' =>TRUE,
  53. 'uppercase FALSE' =>FALSE,
  54. // empty data
  55. 'empty string DQ' => "",
  56. 'empty string SQ' => '',
  57. // string data
  58. 'string DQ' => "string",
  59. 'string SQ' => 'string',
  60. 'mixed case string' => "sTrInG",
  61. 'heredoc' => $heredoc,
  62. // object data
  63. 'instance of classWithToString' => new classWithToString(),
  64. 'instance of classWithoutToString' => new classWithoutToString(),
  65. // undefined data
  66. 'undefined var' => @$undefined_var,
  67. // unset data
  68. 'unset var' => @$unset_var,
  69. // resource
  70. 'resource' => $file_handle
  71. );
  72. foreach($inputs as $variation =>$timezone) {
  73. echo "\n-- $variation --\n";
  74. var_dump( timezone_open($timezone) );
  75. };
  76. // closing the resource
  77. fclose( $file_handle );
  78. ?>
  79. ===DONE===