NativeExtensionTest.php 762B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase
  11. {
  12. public function testGetProperties()
  13. {
  14. $twig = new Twig_Environment(new Twig_Loader_String(), array(
  15. 'debug' => true,
  16. 'cache' => false,
  17. 'autoescape' => false
  18. ));
  19. $d1 = new DateTime();
  20. $d2 = new DateTime();
  21. $output = $twig->render('{{ d1.date }}{{ d2.date }}', compact('d1', 'd2'));
  22. // If it fails, PHP will crash.
  23. $this->assertEquals($output, $d1->date . $d2->date);
  24. }
  25. }