Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UML-3623 Reworkk IsValidLpa.php to accept new entity/siriuslpa #2852

Merged
merged 23 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f134454
UML-3619 wip
allenannom Sep 30, 2024
4fc3d74
UML-3619 wip
allenannom Sep 30, 2024
69c1773
UML-3619 wip
allenannom Oct 2, 2024
0d63ae0
UML-3619 Convert incoming LPAs to combined format (repository layer)
allenannom Oct 3, 2024
a3e77ca
Merge branch 'UML-3619-Convert-incoming-LPAs-to-combined-format-repos…
allenannom Oct 3, 2024
e2e6232
Merge branch 'main' of github.com:ministryofjustice/opg-use-an-lpa
allenannom Oct 3, 2024
e81c347
UML-3619 updated tests and added donotserialize on func
allenannom Oct 3, 2024
141efe2
UML-3619 updated tests
allenannom Oct 3, 2024
310dada
UML-3619 updated tests for codecoverage
allenannom Oct 3, 2024
39d3576
Merge branch 'main' of github.com:ministryofjustice/opg-use-an-lpa
allenannom Oct 3, 2024
fcb451f
Merge branch 'main' into UML-3619-Convert-incoming-LPAs-to-combined-f…
allenannom Oct 3, 2024
3baa4a1
UML-3619 updated lint
allenannom Oct 3, 2024
1ca16d3
Merge branch 'main' of github.com:ministryofjustice/opg-use-an-lpa
allenannom Oct 3, 2024
73c34f9
Merge branch 'main' into UML-3619-Convert-incoming-LPAs-to-combined-f…
allenannom Oct 3, 2024
527cdeb
UML-3619 updated tests and added test case on hydrating sirius & lpa …
allenannom Oct 4, 2024
720d97a
UML-3619 updated tests and added test case on serialising sirius & lp…
allenannom Oct 4, 2024
a75da70
UML-3623 Reworkk IsValidLpa.php to accept new entity/siriuslpa
allenannom Oct 7, 2024
3b9a664
UML-3623 Reworkk IsValidLpa.php to accept new entity/siriuslpa
allenannom Oct 7, 2024
6496b30
UML-3623 casting return to string
allenannom Oct 7, 2024
cb48f1f
UML-3619 wip
allenannom Sep 30, 2024
7377fe5
UML-3619 Convert incoming LPAs to combined format (repository layer)
allenannom Oct 3, 2024
f53d036
Merge branch 'main' into UML-3623-rework-is-valid-lpa
allenannom Oct 8, 2024
bf5cf55
Merge branch 'main' into UML-3623-rework-is-valid-lpa
allenannom Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions service-api/app/src/App/src/Service/Lpa/IsValidLpa.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

use App\Service\Lpa\IsValid\LpaStatus;
use Psr\Log\LoggerInterface;
use App\Entity\Sirius\SiriusLpa;
use App\Service\Lpa\SiriusLpa as OldSiriusLpa;

class IsValidLpa
{
Expand All @@ -19,10 +21,10 @@ public function __construct(
*
* This function is used by codes to check the validity of a LPA and its details to be displayed to user.
*
* @param array|SiriusLpa $lpa An LPA data structure
* @param OldSiriusLpa|SiriusLpa $lpa An LPA data structure
* @return bool True if status is Registered or Cancelled
*/
public function __invoke(array|SiriusLpa $lpa): bool
public function __invoke(OldSiriusLpa|SiriusLpa $lpa): bool
{
$status = $lpa->getStatus();

Expand All @@ -33,7 +35,7 @@ public function __invoke(array|SiriusLpa $lpa): bool
$this->logger->notice(
'LPA with id {lpaUid} has an invalid status of {status}',
[
'status' => $lpa['status'],
'status' => $status,
'lpaUid' => $lpa->getUid(),
]
);
Expand Down
105 changes: 105 additions & 0 deletions service-api/app/test/AppTest/Service/Lpa/IsValidLpaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,109 @@ public function check_if_lpa_valid_when_status_other_than_registered_or_cancelle
$result = $resolver($lpa);
$this->assertFalse($result);
}

#[Test]
public function check_if_lpa_valid_when_status_registered_combined_format(): void
{
$lpa = new \App\Entity\Sirius\SiriusLpa(
$applicationHasGuidance = null,
$applicationHasRestrictions = null,
$applicationType = null,
$attorneyActDecisions = null,
$attorneys = null,
$caseSubtype = null,
$channel = null,
$dispatchDate = null,
$donor = null,
$hasSeveranceWarning = null,
$invalidDate = null,
$lifeSustainingTreatment = null,
$lpaDonorSignatureDate = null,
$lpaIsCleansed = null,
$onlineLpaId = null,
$receiptDate = null,
$registrationDate = null,
$rejectedDate = null,
$replacementAttorneys = null,
$status = 'Registered',
$statusDate = null,
$trustCorporations = null,
$uId = '700000000001',
$withdrawnDate = null
);

$resolver = $this->isValidLpaResolver();
$result = $resolver($lpa);
$this->assertTrue($result);
}

#[Test]
public function check_if_lpa_valid_when_status_cancelled_combined_format(): void
{
$lpa = new \App\Entity\Sirius\SiriusLpa(
$applicationHasGuidance = null,
$applicationHasRestrictions = null,
$applicationType = null,
$attorneyActDecisions = null,
$attorneys = null,
$caseSubtype = null,
$channel = null,
$dispatchDate = null,
$donor = null,
$hasSeveranceWarning = null,
$invalidDate = null,
$lifeSustainingTreatment = null,
$lpaDonorSignatureDate = null,
$lpaIsCleansed = null,
$onlineLpaId = null,
$receiptDate = null,
$registrationDate = null,
$rejectedDate = null,
$replacementAttorneys = null,
$status = 'Cancelled',
$statusDate = null,
$trustCorporations = null,
$uId = '700000000001',
$withdrawnDate = null
);

$resolver = $this->isValidLpaResolver();
$result = $resolver($lpa);
$this->assertTrue($result);
}

#[Test]
public function check_if_lpa_valid_when_status_other_than_registered_or_cancelled_combined_format(): void
{
$lpa = new \App\Entity\Sirius\SiriusLpa(
$applicationHasGuidance = null,
$applicationHasRestrictions = null,
$applicationType = null,
$attorneyActDecisions = null,
$attorneys = null,
$caseSubtype = null,
$channel = null,
$dispatchDate = null,
$donor = null,
$hasSeveranceWarning = null,
$invalidDate = null,
$lifeSustainingTreatment = null,
$lpaDonorSignatureDate = null,
$lpaIsCleansed = null,
$onlineLpaId = null,
$receiptDate = null,
$registrationDate = null,
$rejectedDate = null,
$replacementAttorneys = null,
$status = 'Revoked',
$statusDate = null,
$trustCorporations = null,
$uId = '700000000001',
$withdrawnDate = null
);

$resolver = $this->isValidLpaResolver();
$result = $resolver($lpa);
$this->assertFalse($result);
}
}
Loading