Skip to content

Commit

Permalink
Merge branch 'main' into UML-3620-rework-resolve-actor
Browse files Browse the repository at this point in the history
  • Loading branch information
allenannom committed Oct 9, 2024
2 parents 57cbe20 + 0f3b45c commit 976fa60
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/_build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
- name: ecr login
id: login_ecr
uses: aws-actions/amazon-ecr-login@f8cb900d38ecff281181b9924245b4f0ddc1860a # [email protected]
uses: aws-actions/amazon-ecr-login@d5dd46d537c86e506335323688c342319bedcfe1 # [email protected]
with:
registries: 311462405659
if: |
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:

- name: Trivy Image Vulnerability Scanner
id: trivy_scan
uses: aquasecurity/trivy-action@97646fedde05bcd0961217c60b50e23f721e7ec7
uses: aquasecurity/trivy-action@a20de5420d57c4102486cdd9578b45609c99d7eb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRIVY_DB_REPOSITORY: ${{ steps.login_ecr.outputs.registry }}/trivy-db-public-ecr/aquasecurity/trivy-db:2
Expand Down
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);
}
}

0 comments on commit 976fa60

Please sign in to comment.