datetime_pass.phpt 775 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Test V8::executeString() : Pass JS date to PHP
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. ini_set('v8js.use_date', 1);
  8. // Set date.timezone since run-tests.php calls php without it being set;
  9. // which causes the test to fail on PHP 5.3 as it shows a warning message
  10. // in the output.
  11. ini_set('date.timezone', 'Europe/Berlin');
  12. $a = new V8Js();
  13. $a->var = new \DateTime("Wed, 19 Mar 2014 14:37:11 +0000");
  14. $a->executeString('print(PHP.var.toGMTString()); print("\n");');
  15. ini_set('v8js.use_date', 0);
  16. $a = new V8Js();
  17. $a->var = new \DateTime("Wed, 19 Mar 2014 14:37:11 +0000");
  18. $a->executeString('print(PHP.var.toString()); print("\n");');
  19. ?>
  20. ===EOF===
  21. --EXPECT--
  22. Wed, 19 Mar 2014 14:37:11 GMT
  23. [object DateTime]
  24. ===EOF===