Completed
Push — master ( 48d32a...4da889 )
by Igor
04:45
created
app/Http/Controllers/Auth/AuthController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
             'password' => $request->json('password'),
17 17
         ];
18 18
 
19
-        if (! $token = JWTAuth::attempt($credentials)) {
19
+        if (!$token = JWTAuth::attempt($credentials)) {
20 20
             return response()->json([ 'error' => 'invalid_credentials' ], 401);
21 21
         }
22 22
 
Please login to merge, or discard this patch.
app/Exceptions/Handler.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
     public function render($request, Exception $e)
48 48
     {
49 49
         if ($e instanceof Tymon\JWTAuth\Exceptions\TokenExpiredException) {
50
-     	    return response()->json([ 'token_expired' ], $e->getStatusCode());
50
+                return response()->json([ 'token_expired' ], $e->getStatusCode());
51 51
         } else if ($e instanceof Tymon\JWTAuth\Exceptions\TokenInvalidException) {
52 52
             return response()->json([ 'token_invalid' ], $e->getStatusCode());
53 53
         }
54 54
 
55
-     	return parent::render($request, $e);
56
-     }
55
+            return parent::render($request, $e);
56
+        }
57 57
 }
Please login to merge, or discard this patch.
tests/AuthenticatedTestCase.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         ];
34 34
     }
35 35
 
36
-    public function json($method, $uri, array $data = [], array $headers = [])
36
+    public function json($method, $uri, array $data = [ ], array $headers = [ ])
37 37
     {
38 38
         $headers = array_merge($headers, $this->headers());
39 39
 
Please login to merge, or discard this patch.
tests/Feature/AuthControllerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,6 +29,6 @@
 block discarded – undo
29 29
         // It should return a JWT token
30 30
         $response
31 31
             ->assertStatus(200)
32
-            ->assertJsonStructure(['token']);
32
+            ->assertJsonStructure([ 'token' ]);
33 33
     }
34 34
 }
Please login to merge, or discard this patch.
tests/Feature/AuthControllerInvalidTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
         // It should return an error invalid_credentials
23 23
         $response
24 24
             ->assertStatus(401)
25
-            ->assertJson(['error' => 'invalid_credentials']);
25
+            ->assertJson([ 'error' => 'invalid_credentials' ]);
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
tests/Feature/EmployeeControllerTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $first = $employees->first();
23 23
 
24 24
         // When we request the first one
25
-        $response = $this->json('GET', $this->endpoint . $first->id);
25
+        $response = $this->json('GET', $this->endpoint.$first->id);
26 26
 
27 27
         // It should return a valid, one employee json
28 28
         $response
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
         $id = $findedEmployee ? $findedEmployee->id + 1 : 1;
90 90
 
91 91
         // When we save this new employee
92
-        $newEmployee['password'] = 'teste123';
93
-        $newEmployee['password_confirmation'] = 'teste123';
94
-        $newEmployee['active'] = true;
92
+        $newEmployee[ 'password' ] = 'teste123';
93
+        $newEmployee[ 'password_confirmation' ] = 'teste123';
94
+        $newEmployee[ 'active' ] = true;
95 95
         $response = $this->json('POST', $this->endpoint, $newEmployee);
96 96
 
97 97
         // It should return this valid json employee
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
             ->assertStatus(201)
100 100
             ->assertJson([
101 101
                 'id' => $id,
102
-                'full_name' => $newEmployee['full_name'],
103
-                'br_cpf' => $newEmployee['br_cpf'],
104
-                'email' => $newEmployee['email'],
105
-                'telephone_type' => $newEmployee['telephone_type'],
106
-                'telephone' => $newEmployee['telephone'],
107
-                'zip_code' => $newEmployee['zip_code'],
108
-                'city' => $newEmployee['city'],
109
-                'state' => $newEmployee['state'],
110
-                'avenue' => $newEmployee['avenue'],
111
-                'number' => $newEmployee['number'],
112
-                'neighborhood' => $newEmployee['neighborhood'],
113
-                'complement' => $newEmployee['complement'],
114
-                'active' => $newEmployee['active'],
102
+                'full_name' => $newEmployee[ 'full_name' ],
103
+                'br_cpf' => $newEmployee[ 'br_cpf' ],
104
+                'email' => $newEmployee[ 'email' ],
105
+                'telephone_type' => $newEmployee[ 'telephone_type' ],
106
+                'telephone' => $newEmployee[ 'telephone' ],
107
+                'zip_code' => $newEmployee[ 'zip_code' ],
108
+                'city' => $newEmployee[ 'city' ],
109
+                'state' => $newEmployee[ 'state' ],
110
+                'avenue' => $newEmployee[ 'avenue' ],
111
+                'number' => $newEmployee[ 'number' ],
112
+                'neighborhood' => $newEmployee[ 'neighborhood' ],
113
+                'complement' => $newEmployee[ 'complement' ],
114
+                'active' => $newEmployee[ 'active' ],
115 115
             ])
116 116
             ->assertJsonStructure([
117 117
                 'updated_at',
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 
127 127
         // We create one new employee on memory
128 128
         $employeeModified = factory(Employee::class)->make()->toArray();
129
-        $employeeModified['password'] = 'teste123';
130
-        $employeeModified['password_confirmation'] = 'teste123';
129
+        $employeeModified[ 'password' ] = 'teste123';
130
+        $employeeModified[ 'password_confirmation' ] = 'teste123';
131 131
 
132 132
         // When we edit this employee
133
-        $uri = $this->endpoint . $employee->id;
133
+        $uri = $this->endpoint.$employee->id;
134 134
         $response = $this->json('PUT', $uri, $employeeModified);
135 135
 
136 136
         // And find the employee edited in the database
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $employee = factory(Employee::class)->create();
149 149
 
150 150
         // When we delete this employee
151
-        $uri = $this->endpoint . $employee->id;
151
+        $uri = $this->endpoint.$employee->id;
152 152
         $response = $this->json('DELETE', $uri);
153 153
 
154 154
         // And then try to find it
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $employee->active = false;
169 169
 
170 170
         // When we change this employee to active
171
-        $uri = $this->endpoint . 'active/' . $employee->id;
171
+        $uri = $this->endpoint.'active/'.$employee->id;
172 172
         $response = $this->json('POST', $uri);
173 173
 
174 174
         // And then try to find it
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $employee->active = true;
194 194
 
195 195
         // When we change this employee to inactive
196
-        $uri = $this->endpoint . 'inactive/' . $employee->id;
196
+        $uri = $this->endpoint.'inactive/'.$employee->id;
197 197
         $response = $this->json('POST', $uri);
198 198
 
199 199
         // And then try to find it
Please login to merge, or discard this patch.