This repository was archived by the owner on Jan 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ public function post(Request $request) {
135135 'error ' => [
136136 'code ' => 'simple_oauth_auth_code_invalid_payload ' ,
137137 'message ' => 'Invalid payload: Missing field "email". ' ,
138- ]
138+ ],
139139 ], Response::HTTP_BAD_REQUEST );
140140 }
141141
@@ -144,7 +144,7 @@ public function post(Request $request) {
144144 'error ' => [
145145 'code ' => 'simple_oauth_auth_code_invalid_payload ' ,
146146 'message ' => 'Invalid payload: Missing field "operation". ' ,
147- ]
147+ ],
148148 ], Response::HTTP_BAD_REQUEST );
149149 }
150150
@@ -158,7 +158,7 @@ public function post(Request $request) {
158158 'error ' => [
159159 'code ' => 'simple_oauth_auth_code_invalid_payload ' ,
160160 'message ' => 'Invalid payload ' ,
161- ]
161+ ],
162162 ], Response::HTTP_BAD_REQUEST );
163163 }
164164
Original file line number Diff line number Diff line change @@ -60,17 +60,16 @@ protected function setUp(): void {
6060 * Test auth code generation.
6161 */
6262 public function testGenerateAuthCode () {
63+ $ now = new \DateTimeImmutable ();
6364 $ authCode = $ this ->authCodeGenerator ->generateAuthCode (self ::CLIENT_ID , $ this ->user );
6465
6566 $ this ->assertNotNull ($ authCode );
6667 $ payload = $ this ->decryptAuthCode ($ authCode );
67- $ now = time ();
68-
6968 // Get auth code expiration time from client.
7069 $ expirationTime = (int ) $ this ->client ->get ('one_time_login_auth_code_expiration ' )->value ;
7170
7271 // Create a timestamp that is $expirationTime seconds into the future.
73- $ timestamp = $ expirationTime + $ now ;
72+ $ timestamp = $ expirationTime + $ now-> getTimestamp () ;
7473
7574 $ this ->assertEquals (self ::CLIENT_ID , $ payload ['client_id ' ]);
7675 $ this ->assertEquals ($ this ->user ->id (), $ payload ['user_id ' ]);
Original file line number Diff line number Diff line change 1313use Drupal \user \Entity \User ;
1414use Stack \StackedHttpKernel ;
1515use Symfony \Component \HttpFoundation \Request ;
16- use Symfony \Component \HttpKernel \Kernel ;
1716
1817/**
1918 * Test the auth code rest resource.
@@ -148,7 +147,7 @@ public function testResource() {
148147 $ request = $ this ->createJsonRequest ('POST ' , $ this ->url ->toString (), $ payload );
149148 $ response = $ this ->httpKernel ->handle ($ request );
150149
151- $ this ->assertEquals (401 , $ response ->getStatusCode ());
150+ $ this ->assertEquals (403 , $ response ->getStatusCode ());
152151 }
153152
154153 /**
You can’t perform that action at this time.
0 commit comments