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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 說明 因為HTTP協議是無狀態的,因此在網站開發的過程中我們經常使用session保存用戶信息。 在ThinkPHP的單元測試擴展中,我們是可以對session做出斷言的。 在該測試擴展中,對session斷言的涉及到兩個方法: ~~~ 1. assertSessionHas($key, $value = null) 2. assertSessionHasAll(array $bindings) ~~~ 第一個方法是斷言session中是否有保存某個key,其值對應value。當只提供一個參數的時候,只判斷session是否存在key,而不判斷其值。 第二個方法是對key值數組進行判斷。 # 例子 下面給出一個例子,用于測試session的兩個方法: ~~~ <?php namespace app\index\controller; use think\Session;//注意引入Session class Index { //添加一個值 public function addOneValue(){ Session::clear(); Session::set('value1',1); } //添加多個值 public function addTwoValue(){ Session::clear(); Session::set('value2',2); Session::set('value3',3); } } ~~~ 針對上面的這段代碼,我們可以在tests目錄下增加一個IndexTest.php對其進行測試: ~~~ <?php namespace tests; //針對Index控制器 class IndexTest extends TestCase { public function testAddOneValue(){ $response=$this->visit('/index/index/addOneValue'); $response->assertSessionHas('value1'); $response->assertSessionHas('value1',1); } public function testAddTwoValue(){ $sessData=array( 'value2'=>2, 'value3'=>3 ); $response=$this->visit('/index/index/addTwoValue'); $response->assertSessionHas($sessData); } } ~~~
                  <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>

                              哎呀哎呀视频在线观看