當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SimpleTest::attachObserver方法代碼示例

本文整理匯總了PHP中SimpleTest::attachObserver方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleTest::attachObserver方法的具體用法?PHP SimpleTest::attachObserver怎麽用?PHP SimpleTest::attachObserver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SimpleTest的用法示例。


在下文中一共展示了SimpleTest::attachObserver方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testSpecificSequence

    }
    function testSpecificSequence()
    {
        $mock =& new MockDummy($this);
        $mock->setExpectedArgumentsSequence(1, "aMethod", array(1, 2, 3));
        $mock->setExpectedArgumentsSequence(2, "aMethod", array("Hello"));
        $mock->aMethod();
        $mock->aMethod(1, 2, 3);
        $mock->aMethod("Hello");
        $mock->aMethod();
    }
    function testFailedSequence()
    {
        $test =& new MockTestCase($this);
        $test->setExpectedArguments("assertTrue", array(false, "*"));
        $mock =& new MockDummy($test);
        $mock->setExpectedArgumentsSequence(0, "aMethod", array(1, 2, 3));
        $mock->setExpectedArgumentsSequence(1, "aMethod", array("Hello"));
        $mock->aMethod(1, 2);
        $mock->aMethod("Goodbye");
    }
}
$test = new SimpleTest("Mock components test");
$test->addTestCase(new TestOfParameterList());
$test->addTestCase(new TestOfCallMap());
$test->addTestCase(new TestOfCodeGeneration());
$test->addTestCase(new TestOfMockReturns());
$test->addTestCase(new TestOfMockTally());
$test->addTestCase(new TestOfMockExpectations());
$test->attachObserver(new TestHtmlDisplay());
$test->run();
開發者ID:sebs,項目名稱:simpletest,代碼行數:31,代碼來源:simple_mock_test.php

示例2: testOfReference

        $b = $a;
        $this->assertIdentical($a, $b);
        $a = "0";
        $b = 0;
        $this->assertIdentical($a, $b);
        // Fail.
    }
    function testOfReference()
    {
        $a = "fred";
        $b =& $a;
        $this->assertReference($a, $b);
        $c = "Hello";
        $this->assertReference($a, $c);
        // Fail.
    }
    function testOfPatterns()
    {
        $this->assertWantedPattern("Hello there", '/hello/i');
        $this->assertNoUnwantedPattern("Hello there", '/hello/');
        $this->assertWantedPattern("Hello there", '/hello/');
        // Fail.
        $this->assertNoUnwantedPattern("Hello there", '/hello/i');
        // Fail.
    }
}
$test = new SimpleTest("Unit test case test, 8 fails and 8 passes");
$display = new TestHTMLDisplay();
$test->attachObserver($display);
$test->addTestCase(new TestOfUnitTestCase());
$test->run();
開發者ID:sebs,項目名稱:simpletest,代碼行數:31,代碼來源:simple_unit_test.php


注:本文中的SimpleTest::attachObserver方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。