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"); }
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"); }