예제 #1
0
        <ol>
            <?php 
// Abstract class test.
//
$runnable = new RunnableTest("Me");
assertion("Me" == $runnable->getLabel(), "Expected [Me] got [" . $runnable->getLabel() . "]");
$test_case = new TestCase();
$test_case->attachObserver(new TestOfTestReporter(array(null), array(true), array("stuff")));
$test_case->assertTrue(true, "stuff");
$test_case = new TestCase();
$test_case->attachObserver(new TestOfTestReporter(array(null), array(false), array("more stuff")));
$test_case->assertTrue(false, "more stuff");
// Testing group test with reporter.
//
$test = new GroupTest("Me again");
assertion("Me again" == $test->getLabel(), "Expected [Me again] got [" . $test->getLabel() . "]");
$test->attachObserver(new TestOfTestReporter(array("Me again", "Me again"), array(null, null), array(null, null)));
$test->run();
// Build a test case.
//
class MyTestCase extends TestCase
{
    var $test_variable;
    function MyTestCase()
    {
        $this->TestCase();
    }
    function test()
    {
        $this->assertTrue(true, "True");
    }