<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                TP單元測試擴展中對網頁元素的斷言是基于symfony部分組件的,因此在使用對網頁斷言的時候還需要安裝一個CssSelector的symfony組件。打開命令行,切換到TP的根目錄下,運行下列的命令: `composer require symfony/css-selector:2.8` 等待其安裝后便可以了。下面我們使用幾個例子來說明一下如何使用網頁元素斷言。 # seeInElement 斷言某個元素內是否存在某個元素。 @param $element 指定的元素,如body @param $text 要斷言的文本 @param $negate 是否斷言不存在,默認為false 假設有如下的網頁: ~~~ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> Hello ! </body> </html> ~~~ 如果要斷言字符串hello存在于body元素內,而字符串test不存在body里面,我們可以這么寫: ~~~ <?php namespace tests; //針對Index控制器 class IndexTest extends TestCase { public function testOutput(){ $this->visit('/index/index/index')->seeInElement('body','hello'); $this->visit('/index/index/index')->seeInElement('body','test',TRUE); } } ~~~ # notSeeInElement 效果如同seeInElement中將第三個參數設置為true @param $element 指定的元素,如bod @param $text 要斷言的文本 例子如上。 # seeLink 斷言某個鏈接是否存在,當第二個參數被設置時,同時斷言其鏈接。 @param $text 某個a元素的文本,比如`<a>test</a>`,那么這里應該是test @param $url 默認為null,即斷言找到的鏈接其地址是否為該url 假設有如下的網頁: ~~~ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <a href="http://www.baidu.com">百度一下你就知道</a> </body> </html> ~~~ 如果要斷言鏈接百度一下你就知道的a標簽的地址,可以如下: ~~~ <?php namespace tests; //針對Index控制器 class IndexTest extends TestCase { public function testOutput(){ $this->visit('/index/index/index')->seeLink('百度一下你就知道','http://www.baidu.com'); } } ~~~ # notSeeLink 斷言不存在某個鏈接。 @param $text 某個a元素的文本,比如`<a>test</a>`,那么這里應該是test @param $url 默認為null,即斷言找到的鏈接其地址是否為該url 例子如上。 # SeeInField 對input或者是textArea的value進行斷言。 @param $selector name的值或者是id值 @param $expected 期望valued的值 如下網頁: ~~~ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <form> <input name="test" id="myInput" value="hello" /> </form> </body> </html> ~~~ 我們即可以對name=test的input,也可以對id=myInput的input的value進行斷言: ~~~ <?php namespace tests; //針對Index控制器 class IndexTest extends TestCase { public function testOutput(){ $this->visit('/index/index/index')->seeInField('test','hello');//通過name定位元素 $this->visit('/index/index/index')->seeInField('myInput','hello');//通過id定位元素 } } ~~~ # notSeeInField 對input或者是textArea的value進行斷言。 @param $selector name的值或者是id值 @param $expected 期望valued的值 例子如上。 # seeIsChecked 對某個input選中進行斷言。 # notSeeIsChecked 對某個input不是選中進行斷言。 # seeIsSelected 對某個inpust選擇進行斷言。 # notSeeIsSelected 對某個input不選擇進行斷言。 # seePageIs 對某個頁面的uri進行斷言。
                  <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>

                              哎呀哎呀视频在线观看