-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uml 3692 & UML 3691 grouplpa and sortlpa refactored to handle new for…
…mat (#2902) * UML-3692 & UML-3691 added an interface similar to the current one in order to access donor properties for sort and group lpa invokable functions * added relevant test cases * added GroupLpasInterface.php and moved interface to CombinedLpa.php * added tests for getters in the CombinedLpaTest.php * removed objecthydrator serialising usage and tests as it is un-needed - using json serialising --------- Co-authored-by: Adam Cooper <[email protected]>
- Loading branch information
1 parent
73ee16e
commit 676f8fd
Showing
14 changed files
with
266 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
service-front/app/src/Common/src/Service/Lpa/ServiceInterfaces/GroupLpasInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Common\Service\Lpa\ServiceInterfaces; | ||
|
||
use Common\Entity\Person; | ||
|
||
interface GroupLpasInterface | ||
{ | ||
public function getDonor(): Person; | ||
|
||
public function getCaseSubtype(): string; | ||
} |
14 changes: 14 additions & 0 deletions
14
service-front/app/src/Common/src/Service/Lpa/ServiceInterfaces/SortLpasInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Common\Service\Lpa\ServiceInterfaces; | ||
|
||
use Common\Entity\Person; | ||
|
||
interface SortLpasInterface | ||
{ | ||
public function getDonor(): Person; | ||
|
||
public function getCaseSubtype(): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
service-front/app/test/CommonTest/Entity/CombinedLpaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CommonTest\Entity; | ||
|
||
use Common\Service\Lpa\Factory\LpaDataFormatter; | ||
use DateTimeImmutable; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
|
||
class CombinedLpaTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
private LpaDataFormatter $lpaDataFormatter; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->lpaDataFormatter = new LpaDataFormatter(); | ||
} | ||
|
||
#[Test] | ||
public function can_test_getters() | ||
{ | ||
$lpa = json_decode(file_get_contents(__DIR__ . '../../../../test/fixtures/test_lpa.json'), true); | ||
$combinedLpa = ($this->lpaDataFormatter)($lpa); | ||
|
||
$expectedUid = '700000000047'; | ||
$expectedApplicationHasGuidance = false; | ||
$expectedHasRestrictions = false; | ||
|
||
$this->assertEquals($expectedUid, $combinedLpa->getUId()); | ||
$this->assertEquals($expectedApplicationHasGuidance, $combinedLpa->getApplicationHasGuidance()); | ||
$this->assertEquals($expectedHasRestrictions, $combinedLpa->getApplicationHasRestrictions()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CommonTest\Entity; | ||
|
||
use Common\Service\Lpa\Factory\LpaDataFormatter; | ||
use DateTimeImmutable; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
|
||
class PersonTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
private LpaDataFormatter $lpaDataFormatter; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->lpaDataFormatter = new LpaDataFormatter(); | ||
} | ||
|
||
#[Test] | ||
public function can_test_getters() | ||
{ | ||
$lpa = json_decode(file_get_contents(__DIR__ . '../../../../test/fixtures/test_lpa.json'), true); | ||
$combinedLpa = ($this->lpaDataFormatter)($lpa); | ||
|
||
$expectedSalutation = ''; | ||
$expectedFirstname = 'Rachel'; | ||
$expectedMiddlename = ''; | ||
$expectedSurname = 'Sanderson'; | ||
$expectedDob = new DateTimeImmutable('1948-11-01'); | ||
|
||
$this->assertEquals($expectedSalutation, $combinedLpa->getDonor()->getSalutation()); | ||
$this->assertEquals($expectedFirstname, $combinedLpa->getDonor()->getFirstname()); | ||
$this->assertEquals($expectedMiddlename, $combinedLpa->getDonor()->getMiddlenames()); | ||
$this->assertEquals($expectedSurname, $combinedLpa->getDonor()->getSurname()); | ||
$this->assertEquals($expectedDob, $combinedLpa->getDonor()->getDob()); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
service-front/app/test/CommonTest/Entity/Sirius/SiriusLpaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace CommonTest\Entity\Sirius; | ||
|
||
use Common\Entity\Sirius\SiriusLpaDonor; | ||
use Common\Service\Lpa\Factory\LpaDataFormatter; | ||
use DateTimeImmutable; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
|
||
class SiriusLpaTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
private LpaDataFormatter $lpaDataFormatter; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->lpaDataFormatter = new LpaDataFormatter(); | ||
} | ||
|
||
#[Test] | ||
public function can_get_donor_test() | ||
{ | ||
$lpa = json_decode(file_get_contents(__DIR__ . '../../../../../test/fixtures/test_lpa.json'), true); | ||
$combinedLpa = ($this->lpaDataFormatter)($lpa); | ||
|
||
$expectedDonor = new SiriusLpaDonor( | ||
addressLine1: '81 Front Street', | ||
addressLine2: 'LACEBY', | ||
addressLine3: '', | ||
country: '', | ||
county: '', | ||
dob: new DateTimeImmutable('1948-11-01'), | ||
email: '[email protected]', | ||
firstname: 'Rachel', | ||
firstnames: null, | ||
linked: [ | ||
[ | ||
'id' => 7, | ||
'uId' => '700000000799', | ||
], | ||
], | ||
name: null, | ||
otherNames: null, | ||
postcode: 'DN37 5SH', | ||
surname: 'Sanderson', | ||
systemStatus: null, | ||
town: '', | ||
type: 'Primary', | ||
uId: '700000000799' | ||
); | ||
|
||
$this->assertEquals($expectedDonor, $combinedLpa->getDonor()); | ||
} | ||
|
||
#[Test] | ||
public function can_get_case_sub_type() | ||
{ | ||
$lpa = json_decode(file_get_contents(__DIR__ . '../../../../../test/fixtures/test_lpa.json'), true); | ||
$combinedLpa = ($this->lpaDataFormatter)($lpa); | ||
|
||
$expectedCaseSubType = 'hw'; | ||
|
||
$this->assertEquals($expectedCaseSubType, $combinedLpa->getCaseSubType()); | ||
} | ||
} |
Oops, something went wrong.