Location: PHPKode > projects > PHPLayouts > PHPLayouts/tests/mainTest.php
<?php

/**
 * Classe de test de PHPLayouts
 * 
 * Ce fichier effectue les tests nécessaires
 * pour PHPLayouts avant sa publication
 *
 * @copyright Copyright (c) 2010 Rodix53
 * @author Anthony ROUSSEL <hide@address.com>
 * @package phplayouts
 * 
 * Last modification : Thursday, 25th February 2010
 */

require_once 'simpletest/autorun.php';
require_once '../includes/Template.php';

$tpl = new Template();

class PHPLayoutsTest extends UnitTestCase
{
    public function testVariables()
    {
        global $tpl;
        
        // 0x01 : assign variables.
        $tpl->setVar("test", "simpletest");
        $this->assertEqual($tpl->test, "simpletest");
        
        // 0x02 : clearing variables.
        $tpl->clearVars();
        $this->assertFalse(isset($tpl->test));
        
        // 0x03 : templates directory.
        $this->assertTrue($tpl->setTemplateDir(dirname(__FILE__) . '/../templates'));
    }
    
    public function testLayout()
    {
        global $tpl;
        
        // 1x01 : layouts activation.
        $tpl->layout()->activate();
        $this->assertTrue($tpl->layout()->isActivated());
        
        // 1x02 : layouts desactivation.
        $tpl->layout()->desactivate();
        $this->assertFalse($tpl->layout()->isActivated());
        $tpl->layout()->activate();
        
        // 1x03 : layouts directory.
        $this->assertTrue($tpl->layout()->setLayoutDir(dirname(__FILE__) . '/../templates'));
    }
}
Return current item: PHPLayouts