Example #1
0
 /**
  * Build a mock response object to inject into the response
  *
  * @param  array $data Data to set in the response
  * @return \DuoAuth\Response object
  */
 protected function buildMockResponse($data)
 {
     $response = new \DuoAuth\Response();
     $r = new MockResponse();
     $r->setBody(json_encode($data));
     $response->setData($r);
     return $response;
 }
Example #2
0
 /**
  * Test that the "success" returns correctly (our mock is set to 200, hard-coded)
  */
 public function testSuccessCorrectlySet()
 {
     $content = 'testing';
     $data = json_encode(array('response' => $content));
     $response = new MockResponse();
     $response->setBody($data);
     $this->response->setData($response);
     $this->assertEquals(true, $this->response->success());
 }
Example #3
0
 private function buildMockRequest($data)
 {
     $mockClient = new MockClient();
     $response = new \DuoAuth\Response();
     $r = new MockResponse();
     $r->setBody(json_encode($data));
     $response->setData($r);
     $request = $this->getMock('\\DuoAuth\\Request', array('send'), array($mockClient));
     $request->expects($this->once())->method('send')->will($this->returnValue($response));
     return $request;
 }