DateTimeZone_clone_basic1.phpt 889 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. ===DONE===
  23. --EXPECTF--
  24. *** Testing clone on DateTime objects ***
  25. object(DateTimeZone)#%d (2) {
  26. ["timezone_type"]=>
  27. int(2)
  28. ["timezone"]=>
  29. string(3) "GMT"
  30. }
  31. object(DateTimeZone)#%d (2) {
  32. ["timezone_type"]=>
  33. int(2)
  34. ["timezone"]=>
  35. string(3) "GMT"
  36. }
  37. TEST PASSED : Objects equal but not indetical
  38. ===DONE===