public function testGetRequest()
 {
     // Scenario
     $usrData = ['callback' => ['url' => 'http://usrurl.eu/putFiles/356?auth-key=[key]', 'headers' => ['authKey' => '[key]', 'authToken' => '{{token}}'], 'additionalData' => [['fileSize' => '356MB']], 'verb' => 'PUT', 'keyRegexp' => '[key]', 'tokenRegexp' => '{{token}}']]['callback'];
     $responseData = ['status' => 'success', 'data' => ['jobId' => 3561, 'logs' => ['...' => '...'], 'artifacts' => [['resolution' => '1290x1220', 'format' => 'avi', 'url' => 'http://jessyca.com/artifacts/26781/pippo.avi']], 'customerData' => $usrData['additionalData']]];
     $cr = new CallbackResolver($this->getCredentialsProviderStub());
     $request = $cr->setKeyRegexp($usrData['keyRegexp'])->setTokenRegexp($usrData['tokenRegexp'])->setHeaders($usrData['headers'])->setUrl($usrData['url'])->setVerb($usrData['verb'])->setBody($responseData)->getRequest();
     // Asserzioni
     $this->assertInstanceOf('GuzzleHttp\\Psr7\\Request', $request);
     $this->assertEquals(self::DEFAULT_KEY, $request->getHeader('authKey')[0]);
     $this->assertEquals(self::DEFAULT_TOKEN, $request->getHeader('authToken')[0]);
     $this->assertEquals('PUT', $request->getMethod());
     $this->assertEquals('http://usrurl.eu/putFiles/356?auth-key=' . self::DEFAULT_KEY, $request->getUri());
     $this->assertEquals(json_decode($request->getBody()->getContents(), true), $responseData);
 }
 /**
  * Risolve l'url di download del file
  *
  * @param array $source
  * @return string
  */
 private static function resolveDownloadUrl($source)
 {
     $url = $source['url'];
     $keyRegexp = arrayFind($source, 'keyRegexp');
     $tokenRegexp = arrayFind($source, 'tokenRegexp');
     $resolver = new CallbackResolver();
     $resolver->setUrl($url, $keyRegexp, $tokenRegexp);
     return $resolver->getUrl();
     // $authenticateRequest = ! empty(@$source['authenticate']);
     // if($authenticateRequest) {
     //     $credentials = Peter::login(Peter::USER, Peter::PASSWORD);
     //     if(empty($credentials)) {
     //         throw new \Exception("Autenticazione Peter fallita");
     //     } else {
     //         list($key, $token) = $credentials;
     //         $params = [
     //             $source['keyName'] => $key,
     //             $source['tokenName'] => $token
     //         ];
     //         $url = urlResolver($url, $params);
     //     }
     // }
     // return $url;
 }