本文整理汇总了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>