@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | private function getUserTokenData(): \stdClass |
| 46 | 46 | { |
| 47 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
| 47 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
| 48 | 48 | try { |
| 49 | 49 | $httpClient = new Client(); |
| 50 | 50 | $domain = 'https://astral.eu.auth0.com/'; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $username = env('AUTH0_TEST_USER_NAME'); |
| 54 | 54 | $password = env('AUTH0_TEST_USER_PASS'); |
| 55 | 55 | |
| 56 | - $response = $httpClient->post($domain . 'oauth/token', [ |
|
| 56 | + $response = $httpClient->post($domain.'oauth/token', [ |
|
| 57 | 57 | 'form_params' => [ |
| 58 | 58 | 'grant_type' => 'password', |
| 59 | 59 | 'client_id' => $clientId, |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ]); |
| 65 | 65 | return json_decode($response->getBody()->getContents()); |
| 66 | 66 | } catch (ClientException $exception) { |
| 67 | - throw new Exception("Could not obtain token from Auth0 for testing from $test $domain $clientId $username $password" . $exception->getMessage()); |
|
| 67 | + throw new Exception("Could not obtain token from Auth0 for testing from $test $domain $clientId $username $password".$exception->getMessage()); |
|
| 68 | 68 | } |
| 69 | 69 | }); |
| 70 | 70 | } |
@@ -72,30 +72,30 @@ discard block |
||
| 72 | 72 | protected function decodeHttpContent($content, $unwrap = true) |
| 73 | 73 | { |
| 74 | 74 | if ($unwrap) |
| 75 | - return json_decode($content, true)['data']; |
|
| 75 | + return json_decode($content, true)[ 'data' ]; |
|
| 76 | 76 | return json_decode($content, true); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function http(string $method, string $route, array $payload = []) |
|
| 79 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
| 80 | 80 | { |
| 81 | 81 | return $this->sendRequest($method, $route, $payload, true); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 84 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 85 | 85 | { |
| 86 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
| 87 | - 'Authorization' => 'Bearer ' . $this->getUserTokenData()->id_token, |
|
| 88 | - ] : []); |
|
| 86 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
| 87 | + 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token, |
|
| 88 | + ] : [ ]); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 91 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 92 | 92 | { |
| 93 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
| 94 | - 'Authorization' => 'Bearer ' . $token, |
|
| 95 | - ] : []); |
|
| 93 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
| 94 | + 'Authorization' => 'Bearer '.$token, |
|
| 95 | + ] : [ ]); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
| 98 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
| 99 | 99 | { |
| 100 | 100 | return $this->sendRequest($method, $route, $payload, false); |
| 101 | 101 | } |