コード例 #1
0
ファイル: MoipTestCase.php プロジェクト: moip/moip-sdk-php
 /**
  * If in MOCK mode returns a mocked Requests_Sessesion if in SANDBOX mode, creates a new session.
  *
  * @param string $body        what the request will return
  * @param int    $status_code what http code the request will return
  */
 public function mockHttpSession($body, $status_code = 200)
 {
     if ($this->sandbox_mock == self::SANDBOX) {
         $this->moip->createNewSession();
         return;
     }
     $resp = new Requests_Response();
     $resp->body = $body;
     $resp->status_code = $status_code;
     $sess = $this->getMock('\\Requests_Session');
     $sess->expects($this->once())->method('request')->willReturn($resp);
     $this->moip->setSession($sess);
 }