From cfa8a363a03fbe9bb9e28bd54d6ae68cfdf0dd4a Mon Sep 17 00:00:00 2001 From: Andrew Newton Date: Thu, 29 Aug 2024 10:13:41 +0100 Subject: [PATCH] feat: expand list of licence and application statuses included in messaging dropdown (#285) --- .../ApplicationLicenceList/ByOrganisation.php | 13 +++++++++++-- .../ByOrganisationTest.php | 18 +++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/api/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisation.php b/app/api/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisation.php index a213bd35b3..3d1ab95480 100644 --- a/app/api/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisation.php +++ b/app/api/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisation.php @@ -43,13 +43,22 @@ public function handleQuery(QueryInterface $query): array $licences = $licenceRepository->fetchByOrganisationIdAndStatuses( $orgId, - [Licence::LICENCE_STATUS_VALID, Licence::LICENCE_STATUS_SUSPENDED, Licence::LICENCE_STATUS_CURTAILED], + [ + Licence::LICENCE_STATUS_VALID, + Licence::LICENCE_STATUS_SUSPENDED, + Licence::LICENCE_STATUS_CURTAILED, + Licence::LICENCE_STATUS_SURRENDER_UNDER_CONSIDERATION + ], ); /** @var Application[] $applications */ $applications = $applicationRepository->fetchByOrganisationIdAndStatuses( $orgId, - [Entity::APPLICATION_STATUS_UNDER_CONSIDERATION, Entity::APPLICATION_STATUS_UNDER_CONSIDERATION], + [ + Entity::APPLICATION_STATUS_UNDER_CONSIDERATION, + Entity::APPLICATION_STATUS_UNDER_CONSIDERATION, + Entity::APPLICATION_STATUS_GRANTED + ], ); $results = array_fill_keys(['licences', 'applications'], []); diff --git a/app/api/test/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisationTest.php b/app/api/test/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisationTest.php index fe1dff9e51..a2b9b19f52 100644 --- a/app/api/test/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisationTest.php +++ b/app/api/test/module/Api/src/Domain/QueryHandler/Messaging/ApplicationLicenceList/ByOrganisationTest.php @@ -28,9 +28,21 @@ public function setUp(): void $this->mockRepo(Repository\Application::class, Repository\Application::class); $this->mockRepo(Repository\Licence::class, Repository\Licence::class); - $this->mockedSmServices = ['SectionAccessService' => m::mock(), AuthorizationService::class => m::mock(AuthorizationService::class)->shouldReceive('isGranted')->with(Permission::SELFSERVE_USER, null)->andReturn(true)->shouldReceive('isGranted')->with(Permission::INTERNAL_USER, null)->andReturn(false)->getMock(),]; - - $this->mockedSmServices[AuthorizationService::class]->shouldReceive('getIdentity->getUser->getId')->andReturn(1); + $this->mockedSmServices = [ + 'SectionAccessService' => m::mock(), + AuthorizationService::class => m::mock(AuthorizationService::class) + ->shouldReceive('isGranted') + ->with(Permission::SELFSERVE_USER, null) + ->andReturn(true) + ->shouldReceive('isGranted') + ->with(Permission::INTERNAL_USER, null) + ->andReturn(false) + ->getMock(), + ]; + + $this->mockedSmServices[AuthorizationService::class] + ->shouldReceive('getIdentity->getUser->getId') + ->andReturn(1); parent::setUp(); }