File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
src/Admin/src/Handler/Account
test/Unit/Admin/Handler/Admin Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 55namespace Admin \Admin \Handler \Account ;
66
77use Admin \Admin \Adapter \AuthenticationAdapter ;
8+ use Admin \Admin \Entity \AdminIdentity ;
89use Admin \Admin \Enum \AdminStatusEnum ;
910use Admin \Admin \Enum \SuccessFailureEnum ;
1011use Admin \Admin \Form \LoginForm ;
@@ -90,8 +91,9 @@ public function handle(ServerRequestInterface $request): ResponseInterface
9091
9192 return new RedirectResponse ($ request ->getUri (), StatusCodeInterface::STATUS_SEE_OTHER );
9293 } else {
94+ /** @var AdminIdentity $identity */
9395 $ identity = $ authResult ->getIdentity ();
94- if ($ identity ->getStatus () === AdminStatusEnum::Inactive) {
96+ if ($ identity ->getStatus ()-> value === AdminStatusEnum::Inactive-> value ) {
9597 $ this ->authenticationService ->clearIdentity ();
9698 $ this ->messenger ->addError (Message::ADMIN_INACTIVE );
9799 $ this ->messenger ->addData ('shouldRebind ' , true );
Original file line number Diff line number Diff line change 66
77use Admin \Admin \Entity \Admin ;
88use Admin \Admin \Entity \AdminIdentity ;
9- use Admin \Admin \Form \AdminForm ;
109use Admin \Admin \Handler \Admin \GetAdminLoginListHandler ;
1110use Admin \Admin \Repository \AdminRepository ;
1211use Admin \Admin \Service \AdminServiceInterface ;
@@ -27,9 +26,10 @@ public function testListAdminWillReturnHtmlResponse(): void
2726 $ adminService = $ this ->createMock (AdminServiceInterface::class);
2827 $ template = $ this ->createMock (TemplateRendererInterface::class);
2928 $ authenticationService = $ this ->createMock (AuthenticationServiceInterface::class);
30- $ form = $ this ->createMock (AdminForm::class);
3129 $ adminRepository = $ this ->createMock (AdminRepository::class);
30+ $ request = $ this ->createMock (ServerRequestInterface::class);
3231
32+ $ request ->method ('getQueryParams ' )->willReturn ([]);
3333 $ adminRepository ->method ('findOneBy ' )->willReturn ($ this ->createMock (Admin::class));
3434 $ adminService ->method ('getAdminLogins ' )->willReturn ([
3535 'rows ' => [],
@@ -51,7 +51,7 @@ public function testListAdminWillReturnHtmlResponse(): void
5151 $ authenticationService ,
5252 );
5353
54- $ response = $ handler ->handle ($ this -> createMock (ServerRequestInterface::class) );
54+ $ response = $ handler ->handle ($ request );
5555
5656 $ this ->assertSame ($ response ->getHeader ('content-type ' )[0 ], 'text/html; charset=utf-8 ' );
5757 $ this ->assertSame (StatusCodeInterface::STATUS_OK , $ response ->getStatusCode ());
You can’t perform that action at this time.
0 commit comments