Beispiel #1
0
 public function it_sends_the_right_authorization_header_for_oauth2()
 {
     // Add access token to configuration
     $oauthAccessToken = 'xyz';
     $config = \Judopay\SpecHelper::getConfiguration();
     $config->add('oauthAccessToken', $oauthAccessToken);
     // Create a request
     $this->beConstructedWith($config);
     $request = new \Guzzle\Http\Message\Request('get', 'http://example.com');
     // Add the auth information to the request
     $requestWithAuth = $this->setRequestAuthentication($request);
     // Make sure the Authorization header is correct
     $requestWithAuth->getHeader('Authorization')->__toString()->shouldEqual('Bearer ' . $oauthAccessToken);
 }
 protected function concoctRequest($fixtureFile)
 {
     $request = new \Judopay\Request($this->configuration);
     $request->setClient(\Judopay\SpecHelper::getMockResponseClient(200, $fixtureFile));
     return $request;
 }
 public function it_should_return_the_error_type_in_get_message()
 {
     $response = \Judopay\SpecHelper::getMockResponseFromFixture(400, 'card_payments/create_bad_request.json');
     $this->beConstructedWith('Bad Request', $response);
     $this->getMessage()->shouldEqual('Bad Request');
 }
Beispiel #4
0
 public function it_is_initializable()
 {
     $this->beConstructedWith(new \Judopay\Request(\Judopay\SpecHelper::getConfiguration()));
     $this->shouldHaveType('Judopay\\Model');
 }