コード例 #1
0
ファイル: AuthTest.php プロジェクト: duosecurity/duo_api_php
 public function testPreauthHttpArguments()
 {
     $successful_preauth_response = self::getSuccessfulPreauthResponse();
     $curl_mock = $this->mocked_curl_requester;
     // The actual test being performed is in the 'equalTo(...)' calls.
     $host = "api-duo.example.com";
     $curl_mock->expects($this->once())->method('execute')->willReturn($successful_preauth_response)->with($this->equalTo("https://" . $host . "/auth/v2/preauth"), $this->equalTo('POST'), $this->anything(), $this->anything());
     $duo = new \DuoAPI\Auth("IKEYIKEYIKEYIKEYIKEY", "SKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEY", $host, $curl_mock);
     $duo->preauth("testuser");
 }
コード例 #2
0
ファイル: AuthTest.php プロジェクト: mschwager/duo_api_php
 public function testPreauthHttpArguments()
 {
     $successful_preauth_response = self::getSuccessfulPreauthResponse();
     $curl_mock = $this->getMockBuilder('DuoAPI\\CurlRequester')->setMethods(array('execute', 'options'))->disableOriginalConstructor()->getMock();
     // The actual test being performed is in the 'equalTo(...)' calls.
     $host = "api-duo.example.com";
     $curl_mock->expects($this->once())->method('execute')->willReturn($successful_preauth_response)->with($this->equalTo("https://" . $host . "/auth/v2/preauth"), $this->equalTo('POST'), $this->anything(), $this->anything());
     $nop = function (...$params) {
         return;
     };
     $curl_mock->method('options')->will($this->returnCallback($nop));
     $duo = new DuoAPI\Auth("IKEYIKEYIKEYIKEYIKEY", "SKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEYSKEY", $host, $curl_mock);
     $duo->preauth("testuser");
 }