ClosureQuirksTest.php 718 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /*
  3. * This file is part of Mustache.php.
  4. *
  5. * (c) 2010-2014 Justin Hileman
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * @group lambdas
  12. * @group functional
  13. */
  14. class Mustache_Test_FiveThree_Functional_ClosureQuirksTest extends PHPUnit_Framework_TestCase
  15. {
  16. private $mustache;
  17. public function setUp()
  18. {
  19. $this->mustache = new Mustache_Engine();
  20. }
  21. public function testClosuresDontLikeItWhenYouTouchTheirProperties()
  22. {
  23. $tpl = $this->mustache->loadTemplate('{{ foo.bar }}');
  24. $this->assertEquals('', $tpl->render(array('foo' => function () { return 'FOO'; })));
  25. }
  26. }