Test Setup Failed
Pull Request — master (#18)
by guillaume
21:38
created
app/Providers/AppServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 {
33 33
     public function register()
34 34
     {
35
-        if(config('app.env') === 'testing'){
35
+        if (config('app.env') === 'testing') {
36 36
             $this->app->singleton(OrganizationRepository::class, InMemoryOrganizationRepository::class);
37 37
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
38 38
             $this->app->singleton(UserRepository::class, InMemoryUserRepository::class);
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $this->app->singleton(HashGen::class, InMemoryHashGen::class);
43 43
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
44 44
         }
45
-        if(config('app.env') === 'testing-ti'){
45
+        if (config('app.env') === 'testing-ti') {
46 46
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
47 47
             $this->app->singleton(InvitationRepository::class, InMemoryInvitationRepository::class);
48 48
             $this->app->singleton(PictureHandler::class, InMemoryPictureHandler::class);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             $this->app->singleton(HashGen::class, InMemoryHashGen::class);
53 53
         }
54 54
 
55
-        if(config('app.env') === 'local'){
55
+        if (config('app.env') === 'local') {
56 56
             $this->app->singleton(OrganizationRepository::class, SqlOrganizationRepository::class);
57 57
             $this->app->singleton(InvitationRepository::class, InvitationRepositorySql::class);
58 58
             $this->app->singleton(PictureHandler::class, StoragePictureHandler::class);
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/UserRepositorySql.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function getByEmail(string $email): ?User
17 17
     {
18 18
         $record = \App\User::where('email', $email)->first();
19
-        if(!isset($record)){
19
+        if (!isset($record)) {
20 20
             return null;
21 21
         }
22 22
         $roles = $record->roles()->pluck('name')->toArray();
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     public function getById(string $id): ?User
27 27
     {
28 28
         $record = \App\User::where('uuid', $id)->first();
29
-        if(!isset($record)){
29
+        if (!isset($record)) {
30 30
             return null;
31 31
         }
32 32
         $roles = $record->roles()->pluck('name')->toArray();
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
             ->offset(($page-1)*$perPage)
83 83
             ->limit($perPage)
84 84
             ->get();
85
-        if(empty($records)){
85
+        if (empty($records)) {
86 86
             return [];
87 87
         }
88 88
 
89 89
         $users = [];
90
-        foreach($records as $record){
91
-            if($record->uuid === null){
90
+        foreach ($records as $record) {
91
+            if ($record->uuid === null) {
92 92
                 $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null);
93 93
                 $state = new State($organizationId, null, false, []);
94 94
                 $users[] = new UserDto($identity, $state);
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     public function getAdminOfOrganization(string $organizationId): array
115 115
     {
116 116
         $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get();
117
-        if(empty($records)){
117
+        if (empty($records)) {
118 118
             return [];
119 119
         }
120 120
         $users = [];
121
-        foreach($records as $record){
121
+        foreach ($records as $record) {
122 122
             $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray();
123 123
             $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);
124 124
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function getByProvider(string $provider, string $providerId): ?User
129 129
     {
130 130
         $record = \App\User::where('providers->'.$provider, $providerId)->first();
131
-        if(!isset($record)){
131
+        if (!isset($record)) {
132 132
             return null;
133 133
         }
134 134
         $roles = $record->roles()->pluck('name')->toArray();
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/InvitationRepositorySql.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             ->select()
30 30
             ->where('hash', $hash)
31 31
             ->first();
32
-        if(!isset($record)){
32
+        if (!isset($record)) {
33 33
             return null;
34 34
         }
35 35
         return new Invitation($record->organization_id, $record->email, $record->firstname, $record->lastname);
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryInvitationRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
         $this->invitations[] = $i;
17 17
     }
18 18
 
19
-    public function getByHash(string $hash):?Invitation
19
+    public function getByHash(string $hash): ?Invitation
20 20
     {
21
-        foreach ($this->invitations as $invitation){
22
-            if($invitation->hash() === $hash){
21
+        foreach ($this->invitations as $invitation) {
22
+            if ($invitation->hash() === $hash) {
23 23
                 return $invitation;
24 24
             }
25 25
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryUserRepository.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
         $this->users[] = $u;
17 17
     }
18 18
 
19
-    public function getByEmail(string $email):?User
19
+    public function getByEmail(string $email): ?User
20 20
     {
21
-        foreach ($this->users as $user){
22
-            if($user->email() === $email){
21
+        foreach ($this->users as $user) {
22
+            if ($user->email() === $email) {
23 23
                 return $user;
24 24
             }
25 25
         }
26 26
         return null;
27 27
     }
28 28
 
29
-    public function getById(string $id):?User
29
+    public function getById(string $id): ?User
30 30
     {
31
-        foreach ($this->users as $user){
32
-            if($user->id() === $id){
31
+        foreach ($this->users as $user) {
32
+            if ($user->id() === $id) {
33 33
                 return $user;
34 34
             }
35 35
         }
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public function search(string $organizationId, int $page, int $perPage = 10): array
40 40
     {
41 41
         $users = [];
42
-        foreach($this->users as $user){
43
-            if($user->organizationId() === $organizationId){
42
+        foreach ($this->users as $user) {
43
+            if ($user->organizationId() === $organizationId) {
44 44
                 $users[] = $user->toDto();
45 45
             }
46 46
         }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function update(User $u)
56 56
     {
57
-        foreach ($this->users as $key => $user){
58
-            if($user->id() === $u->id()){
57
+        foreach ($this->users as $key => $user) {
58
+            if ($user->id() === $u->id()) {
59 59
                 $this->users[$key] = $u;
60 60
             }
61 61
         }
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function delete(string $userId)
65 65
     {
66
-        foreach ($this->users as $key => $user){
67
-            if($user->id() === $userId){
66
+        foreach ($this->users as $key => $user) {
67
+            if ($user->id() === $userId) {
68 68
                 unset($this->users[$key]);
69 69
             }
70 70
         }
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     public function getAdminOfOrganization(string $organizationId): array
74 74
     {
75 75
         $users = [];
76
-        foreach ($this->users as $key => $user){
77
-            if($user->organizationId() === $organizationId && $user->isAdmin()){
76
+        foreach ($this->users as $key => $user) {
77
+            if ($user->organizationId() === $organizationId && $user->isAdmin()) {
78 78
                 $users[] = $user;
79 79
             }
80 80
         }
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function getByProvider(string $provider, string $providerId): ?User
85 85
     {
86
-        foreach ($this->users as $user){
87
-            if($user->provider($provider, $providerId) === true){
86
+        foreach ($this->users as $user) {
87
+            if ($user->provider($provider, $providerId) === true) {
88 88
                 return $user;
89 89
             }
90 90
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Ports/InvitationRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 interface InvitationRepository
10 10
 {
11 11
     public function add(Invitation $i);
12
-    public function getByHash(string $hash):?Invitation;
12
+    public function getByHash(string $hash): ?Invitation;
13 13
 }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/InviteUsersInOrganization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     {
30 30
         $invitations = [];
31 31
         $organization = $this->organizationRepository->get($organizationId);
32
-        foreach($users as $user){
32
+        foreach ($users as $user) {
33 33
             $email = $user['email'];
34 34
             $firstname = isset($user['firstname']) ? $user['firstname'] : '';
35 35
             $lastname = isset($user['lastname']) ? $user['lastname'] : '';
Please login to merge, or discard this patch.