@@ -2,14 +2,14 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Modules\User\Entities\User; |
| 4 | 4 | |
| 5 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
| 5 | +$factory->define(User::class, function(Faker\Generator $faker) { |
|
| 6 | 6 | return [ |
| 7 | 7 | 'identity_id' => (new \MongoDB\BSON\ObjectId())->__toString(), |
| 8 | 8 | 'name' => $faker->name, |
| 9 | 9 | 'username' => $faker->userName, |
| 10 | 10 | 'email' => $faker->unique()->safeEmail, |
| 11 | 11 | 'email_verified' => $faker->boolean, |
| 12 | - 'gender' => get_random_array_element(['male', 'female', 'unknown']), |
|
| 12 | + 'gender' => get_random_array_element([ 'male', 'female', 'unknown' ]), |
|
| 13 | 13 | 'avatar' => 'https://i1.wp.com/cdn.auth0.com/avatars/ad.png', |
| 14 | 14 | 'provider' => 'database', |
| 15 | 15 | ]; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function getUserByUserInfo($userInfo) |
| 49 | 49 | { |
| 50 | - return $this->upsertUser($userInfo['profile']); |
|
| 50 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | protected function upsertUser($profile) |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | throw new BadRequestHttpException('Missing token information: Auth0 user id is not set'); |
| 57 | 57 | } |
| 58 | 58 | $identifier = explode('|', $profile->user_id); |
| 59 | - $identityProvider = $identifier[0]; |
|
| 60 | - $id = $identifier[1]; |
|
| 59 | + $identityProvider = $identifier[ 0 ]; |
|
| 60 | + $id = $identifier[ 1 ]; |
|
| 61 | 61 | |
| 62 | 62 | $user = $this->service->find($id); |
| 63 | 63 | if ($user === null) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function getTestUserToken(): \stdClass |
| 95 | 95 | { |
| 96 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
| 96 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
| 97 | 97 | try { |
| 98 | 98 | $httpClient = new Client(); |
| 99 | 99 | $response = $httpClient->post(env('AUTH0_DOMAIN').'oauth/token', [ |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | private function clearAuthorizationCache(): void |
| 44 | 44 | { |
| 45 | - app()['cache']->forget('maklad.permission.cache'); |
|
| 45 | + app()[ 'cache' ]->forget('maklad.permission.cache'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | private function createPermissions(): void |
@@ -51,32 +51,32 @@ |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if ($unwrap) { |
| 54 | - return json_decode($content, true)['data']; |
|
| 54 | + return json_decode($content, true)[ 'data' ]; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return json_decode($content, true); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function http(string $method, string $route, array $payload = []) |
|
| 60 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
| 61 | 61 | { |
| 62 | 62 | return $this->sendRequest($method, $route, $payload, true); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 65 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 66 | 66 | { |
| 67 | 67 | return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
| 68 | 68 | 'Authorization' => 'Bearer '.$this->service->getTestUserToken()->id_token, |
| 69 | - ] : []); |
|
| 69 | + ] : [ ]); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 72 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
| 73 | 73 | { |
| 74 | 74 | return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
| 75 | 75 | 'Authorization' => 'Bearer '.$token, |
| 76 | - ] : []); |
|
| 76 | + ] : [ ]); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
| 79 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
| 80 | 80 | { |
| 81 | 81 | return $this->sendRequest($method, $route, $payload, false); |
| 82 | 82 | } |
@@ -35,23 +35,23 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $this->resolver->setDefaultConnection($this->getDatabase()); |
| 37 | 37 | |
| 38 | - Model::unguarded(function () { |
|
| 38 | + Model::unguarded(function() { |
|
| 39 | 39 | $seeders = $this->getSeeders(); |
| 40 | 40 | |
| 41 | - $priorities = []; |
|
| 42 | - $prioritySeeders = []; |
|
| 43 | - $nonPrioritySeeders = []; |
|
| 41 | + $priorities = [ ]; |
|
| 42 | + $prioritySeeders = [ ]; |
|
| 43 | + $nonPrioritySeeders = [ ]; |
|
| 44 | 44 | foreach ($seeders as $seeder) { |
| 45 | 45 | $priority = get_class_property($seeder, 'priority'); |
| 46 | 46 | if (!is_int($priority) && $priority !== null) { |
| 47 | 47 | throw new Exception('Priority on seeder must be integer'); |
| 48 | 48 | } elseif ($priority !== null && in_array($priority, $priorities)) { |
| 49 | - throw new Exception("Duplicate priority on seeder $seeder with $prioritySeeders[$priority]"); |
|
| 49 | + throw new Exception("Duplicate priority on seeder $seeder with $prioritySeeders[ $priority ]"); |
|
| 50 | 50 | } elseif ($priority === null) { |
| 51 | - $nonPrioritySeeders[] = $seeder; |
|
| 51 | + $nonPrioritySeeders[ ] = $seeder; |
|
| 52 | 52 | } else { |
| 53 | - $priorities[] = $priority; |
|
| 54 | - $prioritySeeders[$priority] = $seeder; |
|
| 53 | + $priorities[ ] = $priority; |
|
| 54 | + $prioritySeeders[ $priority ] = $seeder; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | ksort($prioritySeeders); |
@@ -74,6 +74,6 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | $this->service = $this->laravel->make(BootstrapRegistrarService::class); |
| 76 | 76 | |
| 77 | - return $this->service->getSeeders() ?? []; |
|
| 77 | + return $this->service->getSeeders() ?? [ ]; |
|
| 78 | 78 | } |
| 79 | 79 | } |
@@ -21,10 +21,10 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $this->artisan('migrate:fresh'); |
| 23 | 23 | $this->artisan('cache:model:clear'); |
| 24 | - app()['cache']->forget('maklad.permission.cache'); |
|
| 24 | + app()[ 'cache' ]->forget('maklad.permission.cache'); |
|
| 25 | 25 | $this->artisan('db:seed'); |
| 26 | 26 | |
| 27 | - $this->beforeApplicationDestroyed(function () { |
|
| 27 | + $this->beforeApplicationDestroyed(function() { |
|
| 28 | 28 | $this->artisan('cache:model:clear'); |
| 29 | 29 | $this->artisan('migrate:rollback'); |
| 30 | 30 | RefreshDatabaseState::$migrated = false; |
@@ -179,6 +179,6 @@ |
||
| 179 | 179 | public function testGetClassConstants() |
| 180 | 180 | { |
| 181 | 181 | $this->assertArrayHasKey('TEST_CONSTANT', get_class_constants(static::class)); |
| 182 | - $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)['TEST_CONSTANT']); |
|
| 182 | + $this->assertEquals(self::TEST_CONSTANT, get_class_constants(static::class)[ 'TEST_CONSTANT' ]); |
|
| 183 | 183 | } |
| 184 | 184 | } |