<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 對輸出進行測試 有時候,想要斷言(比如說)某方法的運行過程中生成了預期的輸出(例如,通過 `echo` 或 `print`)。`PHPUnit_Framework_TestCase` 類使用 PHP 的 [輸出緩沖](http://www.php.net/manual/en/ref.outcontrol.php) 特性來為此提供必要的功能支持。 [Example?2.16, “對函數或方法的輸出進行測試”](# "Example?2.16.?對函數或方法的輸出進行測試")展示了如何用 `expectOutputString()` 方法來設定所預期的輸出。如果沒有產生預期的輸出,測試將計為失敗。 **Example?2.16.?對函數或方法的輸出進行測試** ~~~ <?php class OutputTest extends PHPUnit_Framework_TestCase { public function testExpectFooActualFoo() { $this->expectOutputString('foo'); print 'foo'; } public function testExpectBarActualBaz() { $this->expectOutputString('bar'); print 'baz'; } } ?> ~~~ ~~~ phpunit OutputTest PHPUnit 5.0.0 by Sebastian Bergmann and contributors. .F Time: 0 seconds, Memory: 5.75Mb There was 1 failure: 1) OutputTest::testExpectBarActualBaz Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'bar' +'baz' FAILURES! Tests: 2, Assertions: 2, Failures: 1. ~~~ [Table?2.2, “用于對輸出進行測試的方法”](# "Table?2.2.?用于對輸出進行測試的方法")中列舉了用于對輸出進行測試的各種方法。 **Table?2.2.?用于對輸出進行測試的方法** | 方法 | 含義 | |-----|-----| | void expectOutputRegex(string $regularExpression) | 設置輸出預期為輸出應當匹配正則表達式 `$regularExpression`。 | | void expectOutputString(string $expectedString) | 設置輸出預期為輸出應當與 `$expectedString` 字符串相等。 | | bool setOutputCallback(callable $callback) | 設置回調函數,用來做諸如將實際輸出規范化之類的動作。 | >[info] ### Note > 在嚴格模式下,本身產生輸出的測試將會失敗。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看