Commit 04e4a9ce authored by jepso's avatar jepso

added assertNull() and assertNotNull()

parent 6737c5ce
......@@ -2,9 +2,9 @@
class UnitTestCase
{
protected $_passed = 0;
protected $_failed = 0;
protected $_messages = array();
public function assertEqual($value, $value2)
......@@ -62,13 +62,32 @@ class UnitTestCase
$this->_fail();
}
}
public function pass()
public function assertNull($expr)
{
if (is_null($expr)) {
$this->pass();
} else {
$this->fail();
}
}
public function assertNotNull($expr)
{
if (is_null($expr)) {
$this->fail();
} else {
$this->pass();
}
}
public function pass()
{
$this->_passed++;
}
public function fail($message = "")
{
$this->_fail($message);
$this->_fail($message);
}
public function _fail($message = "")
{
......@@ -92,7 +111,7 @@ class UnitTestCase
}
$this->_failed++;
}
public function run(DoctrineTest_Reporter $reporter = null, $filter = null)
public function run(DoctrineTest_Reporter $reporter = null, $filter = null)
{
foreach (get_class_methods($this) as $method) {
if (substr($method, 0, 4) === 'test') {
......@@ -102,7 +121,7 @@ class UnitTestCase
}
}
}
public function getMessages()
public function getMessages()
{
return $this->_messages;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment