DateTimeZone_clone_basic1.phpt 864 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test clone on DateTimeZone objects
  3. --FILE--
  4. <?php
  5. //Set the default time zone
  6. date_default_timezone_set('Europe/London');
  7. echo "*** Testing clone on DateTime objects ***\n";
  8. // Create a DateTimeZone object..
  9. $orig = new DateTimeZone("GMT");
  10. // ..create a clone of it ..Clone
  11. $clone = clone $orig;
  12. var_dump($orig);
  13. var_dump($clone);
  14. if ($clone != $orig) {
  15. echo "TEST FAILED : objects not equal\n";
  16. }else if ($clone === $orig) {
  17. echo "TEST FAILED : objects identical\n";
  18. } else {
  19. echo "TEST PASSED : Objects equal but not indetical\n";
  20. }
  21. ?>
  22. --EXPECTF--
  23. *** Testing clone on DateTime objects ***
  24. object(DateTimeZone)#%d (2) {
  25. ["timezone_type"]=>
  26. int(2)
  27. ["timezone"]=>
  28. string(3) "GMT"
  29. }
  30. object(DateTimeZone)#%d (2) {
  31. ["timezone_type"]=>
  32. int(2)
  33. ["timezone"]=>
  34. string(3) "GMT"
  35. }
  36. TEST PASSED : Objects equal but not indetical