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