本文整理汇总了PHP中TestCase::attachObserver方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::attachObserver方法的具体用法?PHP TestCase::attachObserver怎么用?PHP TestCase::attachObserver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase
的用法示例。
在下文中一共展示了TestCase::attachObserver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunnableTest
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
{
var $test_variable;
function MyTestCase()
{
$this->TestCase();