Example #1
0
    <head>
        <title>Test of basic test classes used in SimpleTest</title>
        <style type="text/css">
            .pass { color: green; }
            .fail { color: red; }
            body { padding: 1em; }
        </style>
    </head>
    <body>
        <h1>Simple test script for simple test</h1>
        <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