Esempio n. 1
0
        $this->assertIdentical($a, $b);
        // Fail.
        $this->assertNotIdentical($a, $b);
    }
    function testOfReference()
    {
        $a = "fred";
        $b = $a;
        $this->assertReference($a, $b);
        $this->assertCopy($a, $b);
        // Fail.
        $c = "Hello";
        $this->assertReference($a, $c);
        // Fail.
        $this->assertCopy($a, $c);
    }
    function testOfPatterns()
    {
        $this->assertWantedPattern('/hello/i', "Hello there");
        $this->assertNoUnwantedPattern('/hello/', "Hello there");
        $this->assertWantedPattern('/hello/', "Hello there");
        // Fail.
        $this->assertNoUnwantedPattern('/hello/i', "Hello there");
        // Fail.
    }
}
$test = new GroupTest("Unit test case test, 14 fails and 14 passes");
$display = new TestHTMLDisplay();
$test->attachObserver($display);
$test->addTestCase(new TestOfUnitTestCase());
$test->run();
Esempio n. 2
0
/*		require_once(CONCERTO.'/tests/dbconnect.inc.php'); */
/*	} */
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler");
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$test = new GroupTest('CourseManagementTest');
$test->addTestFile(dirname(__FILE__) . '/CanonicalCourseTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGroupTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseOfferingTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TermTest.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseSectionTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/EnrollmentRecordTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGradeRecordTest.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
$timer->end();
print "\n<br />Harmoni Load Time: " . $harmonyLoadupTimer->printTime();
print "\n<br />Overall Time: " . $timer->printTime();
$dbhandler = Services::getService("DBHandler");
printpre("NumQueries: " . $dbhandler->getTotalNumberOfQueries());
print "\n</p>";
// $num = $dbHandler->getTotalNumberOfQueries();
// debug::output("Total # of queries: ".$num,1,"DBHandler");
//debug::printAll();
// unset($dbHandler,$errorHandler, $userError);
// unset($num);
//	$errorHandler->printErrors(HIGH_DETAIL);
//	print "<pre>";
//	print_r($errorHandler);
Esempio n. 3
0
    {
        $this->assertTrue($this->test_variable == 13, "True");
    }
    function setUp()
    {
        $this->test_variable = 13;
    }
    function tearDown()
    {
        $this->test_variable = 0;
    }
}
$test = new GroupTest("Me");
$test_case = new MyTestCase();
$test->addTestCase($test_case);
$test->attachObserver(new TestOfTestReporter(array("Me", "mytestcase", "test", null, "test", "test2", null, "test2", "mytestcase", "Me"), array(null, null, null, true, null, null, true, null, null, null), array(null, null, null, "True", null, null, "True", null, null, null)));
$test->run();
assertion(0 == $test_case->test_variable, "Expected [0] got [" . $test_case->test_variable . "]");
// Collect test cases from a script.
//
$test = new GroupTest("Script");
$test->addTestFile("support/dummy_test_1.php");
$test->addTestFile("support/dummy_test_2.php");
$test->attachObserver(new TestOfTestReporter(array("Script", "support/dummy_test_1.php", "DummyTestOneA", "testOneA", null, "testOneA", "DummyTestOneA", "DummyTestOneB", "testOneB", null, "testOneB", "DummyTestOneB", "support/dummy_test_1.php", "support/dummy_test_2.php", "DummyTestTwo", "testTwo", null, "testTwo", "DummyTestTwo", "support/dummy_test_2.php", "Script"), array(null, null, null, null, true, null, null, null, null, true, null, null, null, null, null, null, true, null, null, null, null), array(null, null, null, null, "True", null, null, null, null, "True", null, null, null, null, null, null, "True", null, null, null, null)));
$test->run();
?>
        </ol>
        <div><em>Should have all passed.</em></div>
    </body>
</html>