Location: PHPKode > projects > PHPTAL > PHPTAL-1.2.2/tests/TalesIssetNullTest.php
<?php
/**
 * PHPTAL templating engine
 *
 * PHP Version 5
 *
 * @category HTML
 * @package  PHPTAL
 * @author   Laurent Bedubourg <hide@address.com>
 * @author   Kornel Lesiński <hide@address.com>
 * @license  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
 * @version  SVN: $Id: TalesIssetNullTest.php 888 2010-06-08 09:48:33Z kornel $
 * @link     http://phptal.org/
 */

class DummyObjectX
{
    public function __contruct()
    {
        $this->_data = array();
    }
    public function __isset($var)
    {
        return array_key_exists($var, $this->_data);
    }
    public function __get($var)
    {
        return $this->_data[$var];
    }
    public function __set($var, $value)
    {
        $this->_data[$var] = $value;
    }
    public function __call($method, $params)
    {
        return '__call';
    }
    private $_data;
}



class TalesIssetNullTest extends PHPTAL_TestCase
{
    function testIt()
    {
        $dummy = new DummyObjectX();
        $dummy->foo = null;

        $res = PHPTAL_Context::path($dummy, 'method');
        $this->assertEquals('__call', $res);

        $res = phptal_path($dummy, 'foo');
        $this->assertEquals(null, $res);
    }
}


Return current item: PHPTAL