2010年1月17日 星期日

CuTestUnit - Easy way to Unit Test.

// Easy way to Unit Test.



// CuTestUnit.php

class CuTestUnit
{
    var $debug;
    
    function __construct()
    {
        $this->debug = new CuDebugger; 
    }   
    
    function CuTestUnit()
    {
        $this->__construct();
    }
    
    function assertTrue($bool, $key = null )
    {
        if( !$bool || $bool != true)
            $result = "<font color = '#ff0000'>FALSE</font>";
        else
            $result = "<font color = '#0000ff'>OK</font>";
        
        $this->debug->debug($result,  $key);  
    }
    
    function assertEquals($value1, $value2, $key = null)
    {
        $this->assertTrue($value1 == $value2, $key);
    }
    
    function GetHTML()
    {
        return $this->debug->GetHTML();
    }
    
}

沒有留言:

張貼留言