PHP Classes

File: tests/unit/Template/BaseTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Template/BaseTest.php   Download  
File: tests/unit/Template/BaseTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 1,026 bytes
 

Contents

Class file image Download
<?php

class Template extends A_Template_Base {

    public function
getForTesting($name)
    {
        return
$this->$name;
    }
   
    public function
render()
    {
       
    }
}

class
TemplateTest extends UnitTestCase {
   
    function
setUp() {
    }
   
    function
TearDown() {
    }
   
    function
testTemplateNoConstructArgs() {
       
$Template = new Template();
       
       
$this->assertEqual($Template->getForTesting('filename'), '');
       
$this->assertEqual($Template->getForTesting('data'), array());
    }
   
    function
testTemplateConstructArgs() {
       
$args = array('bar'=>7);
       
$Template = new Template('foo', $args);
       
       
// check if filename and data set
       
$this->assertEqual($Template->getForTesting('filename'), 'foo');
       
$this->assertEqual($Template->getForTesting('data'), $args);
       
$this->assertEqual($Template->get('bar'), 7);
       
// manually set data to see change
       
$this->assertEqual($Template->setFilename('baz')->getForTesting('filename'), 'baz');
       
$this->assertEqual($Template->set('bar', 9)->get('bar'), 9);
    }
   
}