/**
  *
  * Provide test coverage for major methods, some simple method are knowingly skiped.
  *
  * @param string        $operation
  * @param string        $apiKeySecret
  * @param string        $expectedSignature
  * @param string|null   $expectedErrorMsg
  * @param array         $data
  *
  * @dataProvider providerTestOperationAndSignature
  */
 public function testOperationAndSignature($operation, $apiKeySecret, $expectedSignature, $expectedErrorMsg, $data)
 {
     try {
         $req = new Raven\Request($operation, $data);
         $req->setSignature($apiKeySecret);
         $this->assertEquals($expectedSignature, $req->get('signature'));
     } catch (Raven\Exceptions\SignatureException $e) {
         $this->assertEquals($expectedErrorMsg, $e->getMessage());
     }
 }
 public function echoOutput($dataProviderIndex, Request $request, Response $response = null)
 {
     if ($this->isOutput) {
         echo "\r\n-- " . strtoupper($dataProviderIndex . " " . $request->getOperation()) . " " . str_repeat("-", 80 - (4 + strlen($dataProviderIndex . " " . $request->getOperation()))) . "\r\n";
         echo "Request Details: " . json_encode($request->all(), JSON_PRETTY_PRINT) . "\r\n";
         if (!is_null($response)) {
             echo "Response Details: \r\nStatus: " . $response->getHttpResponseStatus() . "  Resaon: " . $response->getHttpResponseReason() . "\r\nSignature Validation Results: " . json_encode($response->getSignatureViladtionResults(), JSON_PRETTY_PRINT) . "\r\nResults: " . json_encode($response->all(), JSON_PRETTY_PRINT) . "\r\n";
         }
     }
 }
Esempio n. 3
0
 /**
  * @param Request $request
  * @return array $httpResponseHeader, $rawResponseData, $decodeResponseData
  */
 protected function makeHttpClientCall(Request $request)
 {
     //function broken out for testing (mock this method)
     return list($httpResponseHeader, $rawResponseData) = Httpclient\CurlClient::postRequest($this->endpoint . '/' . $request->getOperation(), $request->all());
 }