* @author Kornel LesiƄski * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License * @version SVN: $Id: PhptalPathTest.php 888 2010-06-08 09:48:33Z kornel $ * @link http://phptal.org/ */ class PhptalPathTest_DummyClass { public $foo; protected function protTest() { return 'prot-method'; } public $protTest = 'prot-property'; public function pubTest() { return 'pub-method'; } public $pubTest = 'pub-property'; } class PhptalPathTest extends PHPTAL_TestCase { function testZeroIndex() { $data = array(1, 0, 3); $result = PHPTAL_Context::path($data, '0'); $this->assertEquals(1, $result); } function testProtectedMethodIgnored() { $tpl = $this->newPHPTAL(); $tpl->obj = new PhptalPathTest_DummyClass(); $tpl->setSource(''); $this->assertEquals('prot-property', $tpl->execute()); } function testPublicMethodFirst() { $tpl = $this->newPHPTAL(); $tpl->obj = new PhptalPathTest_DummyClass(); $tpl->setSource(''); $this->assertEquals('pub-method', $tpl->execute()); } function testDefinedButNullProperty() { $src = << EOS; $exp = << blah ok EOS; $tpl = $this->newPHPTAL(); $tpl->setSource($src, __FILE__); $tpl->o = new PhptalPathTest_DummyClass(); $res = $tpl->execute(); $this->assertEquals($exp, $res); } }