* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: TalesClosuresTest.php 888 2010-06-08 09:48:33Z kornel $ * @link http://phptal.org/ */ class TalesClosuresTest extends PHPTAL_TestCase { function testClosure() { $this->markTestIncomplete(); if (version_compare("5.3", PHP_VERSION, ">")) $this->markTestSkipped(); $tpl = $this->newPHPTAL(); /* 5.2 can't parse it */ eval(' $tpl->closure = function(){return array("testif"=>array("works"=>"fine"));}; '); $tpl->setSource(""); $this->assertEquals("fine", $tpl->execute()); } function testInvoke() { $this->markTestIncomplete(); if (version_compare("5.3", PHP_VERSION, ">")) $this->markTestSkipped(); $tpl = $this->newPHPTAL(); $tpl->invoke = new TestInvocable; $tpl->setSource(""); $this->assertEquals("well", $tpl->execute()); } function testInvokeProperty() { $this->markTestIncomplete(); if (version_compare("5.3", PHP_VERSION, ">")) $this->markTestSkipped(); $tpl = $this->newPHPTAL(); $tpl->invoke = new TestInvocable; $tpl->setSource(""); $this->assertEquals("ok", $tpl->execute()); } } class TestInvocable { function __invoke() { return array('testif'=>array('works'=>'well')); } public $prop = 'ok'; }