Changeset 3549

Show
Ignore:
Timestamp:
01/18/08 19:35:15 (18 months ago)
Author:
jepso
Message:

added assertNull() and assertNotNull()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/DoctrineTest/UnitTestCase.php

    r3460 r3549  
    33{ 
    44    protected $_passed = 0; 
    5      
     5 
    66    protected $_failed = 0; 
    7      
     7 
    88    protected $_messages = array(); 
    99 
     
    6363        } 
    6464    } 
    65     public function pass()  
     65 
     66    public function assertNull($expr) 
     67    { 
     68        if (is_null($expr)) { 
     69            $this->pass(); 
     70        } else { 
     71            $this->fail(); 
     72        } 
     73    } 
     74 
     75    public function assertNotNull($expr) 
     76    { 
     77        if (is_null($expr)) { 
     78            $this->fail(); 
     79        } else { 
     80            $this->pass(); 
     81        } 
     82    } 
     83 
     84    public function pass() 
    6685    { 
    6786        $this->_passed++; 
     
    6988    public function fail($message = "") 
    7089    { 
    71         $this->_fail($message);     
     90        $this->_fail($message); 
    7291    } 
    7392    public function _fail($message = "") 
     
    93112        $this->_failed++; 
    94113    } 
    95     public function run(DoctrineTest_Reporter $reporter = null, $filter = null)  
     114    public function run(DoctrineTest_Reporter $reporter = null, $filter = null) 
    96115    { 
    97116        foreach (get_class_methods($this) as $method) { 
     
    103122        } 
    104123    } 
    105     public function getMessages()  
     124    public function getMessages() 
    106125    { 
    107126        return $this->_messages;