本文整理匯總了PHP中GroupTest::attachObserver方法的典型用法代碼示例。如果您正苦於以下問題:PHP GroupTest::attachObserver方法的具體用法?PHP GroupTest::attachObserver怎麽用?PHP GroupTest::attachObserver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GroupTest
的用法示例。
在下文中一共展示了GroupTest::attachObserver方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testOfReference
$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();
示例2: OsidContext
/* 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);
示例3: setUp
{
$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>