Esempio n. 1
0
 private function getDefaultAuthHeaderArray()
 {
     if (!$this->credential->isAuthenticated()) {
         $this->authenticateCredential();
     }
     return array("X-Application" => $this->credential->getApplicationKey(), "X-Authentication" => $this->credential->getSessionToken());
 }
 public function it_do_sport_api_ng_request_with_authenticated_credentials(CredentialInterface $credential, BetfairGuzzleClient $betfairHttpClient, Param $param, Response $response)
 {
     $operationName = 'listApiThing';
     $credential->isAuthenticated()->willReturn(true);
     $credential->getApplicationKey()->willReturn('app-key');
     $credential->getSessionToken()->willReturn('session-token');
     $expectedGuzzleParameters = array("X-Application" => 'app-key', "X-Authentication" => 'session-token', 'method' => "SportsAPING/v1.0/" . $operationName, 'type' => 'betting', 'params' => $param);
     $betfairHttpClient->apiNgRequest($expectedGuzzleParameters)->shouldBeCalled()->willReturn($response);
     $response->getBody()->shouldBeCalled()->willReturn('body response');
     $this->apiNgRequest($operationName, $param, "betting")->shouldReturn("body response");
 }