Exemplo n.º 1
0
 public function getDataFromModem()
 {
     $this->client->authorize();
     $httpResponse = $this->client->fetchDownstreamData();
     $this->client->unauthorize();
     return $httpResponse;
 }
Exemplo n.º 2
0
 public function testAuthorize()
 {
     $csrfTokenHtml = 'name="CSRFValue" value=345353334>';
     $loginFormUrl = $this->modemOptions['url'] . $this->modemOptions['login_form'];
     $responseLoginForm = new Response(200, array(), $csrfTokenHtml);
     $this->httpClientMock->expects($this->at(0))->method('request')->with('GET', $loginFormUrl)->willReturn($responseLoginForm);
     $authorizationUrl = sprintf('%s%s', $this->modemOptions['url'], $this->modemOptions['auth_check']);
     $response = new Response(200, array(), 'some body');
     $this->httpClientMock->expects($this->at(1))->method('request')->with('POST', $authorizationUrl)->willReturn($response);
     $result = $this->client->authorize();
     $this->assertTrue($result);
 }