@@ -44,10 +44,10 @@ 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 | - $response = $httpClient->post(env('AUTH0_DOMAIN') . 'oauth/token', [ |
|
50 | + $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
|
51 | 51 | 'form_params' => [ |
52 | 52 | 'grant_type' => 'password', |
53 | 53 | 'client_id' => env('AUTH0_CLIENT_ID'), |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ]); |
59 | 59 | return json_decode($response->getBody()->getContents()); |
60 | 60 | } catch (ClientException $exception) { |
61 | - throw new Exception("Could not obtain token from Auth0 at " . env('AUTH0_DOMAIN') . " for testing."); |
|
61 | + throw new Exception("Could not obtain token from Auth0 at ".env('AUTH0_DOMAIN')." for testing."); |
|
62 | 62 | } |
63 | 63 | }); |
64 | 64 | } |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | protected function decodeHttpContent($content, $unwrap = true) |
67 | 67 | { |
68 | 68 | if ($unwrap) |
69 | - return json_decode($content, true)['data']; |
|
69 | + return json_decode($content, true)[ 'data' ]; |
|
70 | 70 | return json_decode($content, true); |
71 | 71 | } |
72 | 72 | |
73 | - protected function http(string $method, string $route, array $payload = []) |
|
73 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
74 | 74 | { |
75 | 75 | return $this->sendRequest($method, $route, $payload, true); |
76 | 76 | } |
77 | 77 | |
78 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
78 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
79 | 79 | { |
80 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
81 | - 'Authorization' => 'Bearer ' . $this->getUserTokenData()->id_token, |
|
82 | - ] : []); |
|
80 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
81 | + 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token, |
|
82 | + ] : [ ]); |
|
83 | 83 | } |
84 | 84 | |
85 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
85 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
86 | 86 | { |
87 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
88 | - 'Authorization' => 'Bearer ' . $token, |
|
89 | - ] : []); |
|
87 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
88 | + 'Authorization' => 'Bearer '.$token, |
|
89 | + ] : [ ]); |
|
90 | 90 | } |
91 | 91 | |
92 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
92 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
93 | 93 | { |
94 | 94 | return $this->sendRequest($method, $route, $payload, false); |
95 | 95 | } |