国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

實(shí)現(xiàn) PHPUnit_Framework_TestListener

2018-02-24 15:42 更新

實(shí)現(xiàn) PHPUnit_Framework_TestListener

Example?14.3, “簡(jiǎn)單的測(cè)試監(jiān)聽(tīng)器”展示了 PHPUnit_Framework_TestListener 接口的一個(gè)簡(jiǎn)單實(shí)現(xiàn)。

Example?14.3.?簡(jiǎn)單的測(cè)試監(jiān)聽(tīng)器

<?php
class SimpleTestListener implements PHPUnit_Framework_TestListener
{
    public function addError(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
        printf("Error while running test '%s'.\n", $test->getName());
    }

    public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
    {
        printf("Test '%s' failed.\n", $test->getName());
    }

    public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
        printf("Test '%s' is incomplete.\n", $test->getName());
    }

    public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
        printf("Test '%s' is deemed risky.\n", $test->getName());
    }

    public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time)
    {
        printf("Test '%s' has been skipped.\n", $test->getName());
    }

    public function startTest(PHPUnit_Framework_Test $test)
    {
        printf("Test '%s' started.\n", $test->getName());
    }

    public function endTest(PHPUnit_Framework_Test $test, $time)
    {
        printf("Test '%s' ended.\n", $test->getName());
    }

    public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
    {
        printf("TestSuite '%s' started.\n", $suite->getName());
    }

    public function endTestSuite(PHPUnit_Framework_TestSuite $suite)
    {
        printf("TestSuite '%s' ended.\n", $suite->getName());
    }
}
?>

Example?14.4, “使用測(cè)試監(jiān)聽(tīng)器基類”展示了如何從抽象類 PHPUnit_Framework_BaseTestListener 派生子類,這個(gè)抽象類為所有接口方法提供了空白實(shí)現(xiàn),這樣你就只需要指定那些在你的使用情境下有意義的接口方法。

Example?14.4.?使用測(cè)試監(jiān)聽(tīng)器基類

<?php
class ShortTestListener extends PHPUnit_Framework_BaseTestListener
{
    public function endTest(PHPUnit_Framework_Test $test, $time)
    {
        printf("Test '%s' ended.\n", $test->getName());
    }
}
?>

the section called “測(cè)試監(jiān)聽(tīng)器”中可以看到如何配置 PHPUnit 來(lái)將測(cè)試監(jiān)聽(tīng)器附加到測(cè)試執(zhí)行過(guò)程上。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)