Skip to content

Commit

Permalink
UML- 3791:Unable to remove an LPA that you are cancelled on (#3071)
Browse files Browse the repository at this point in the history
* Incorporating the major frontend change from the GovUK Design System

* reverted the unnecessary changes

* Changes made for the bug fix including test addition
  • Loading branch information
SeemaMenon authored Jan 17, 2025
1 parent dc77b23 commit 38c7bd6
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
12 changes: 12 additions & 0 deletions service-front/app/features/actor-remove-lpa.feature
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@ Feature: Remove an LPA from my account
Given I am on the dashboard page
When I request to remove an LPA from my account without the lpa actor token
Then I should be shown an error page

@ui
Scenario: The user can remove their LPA from their account when no active attorneys on LPA
Given I am on the dashboard page
When I request to remove an LPA from my account that has no active attorney on it
And I confirm that I want to remove the LPA from my account
Then The LPA is removed
And I am taken back to the dashboard page
And I cannot see my LPA on the dashboard
And I can see a flash message confirming that my LPA has been removed


26 changes: 26 additions & 0 deletions service-front/app/features/context/UI/LpaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2453,6 +2453,32 @@ public function iRequestToRemoveAnLPAFromMyAccountThatIs($status): void
$this->ui->assertPageAddress('/lpa/remove-lpa');
}

/**
* @When /^I request to remove an LPA from my account that has no active attorney on it$/
*/
public function iRequestToRemoveAnLPAFromMyAccountThatHasNoActiveAttorneysOnIt(): void
{
$this->lpa->status = 'Registered';

// API call for get LpaById
$this->apiFixtures->append(
ContextUtilities::newResponse(
StatusCodeInterface::STATUS_OK,
json_encode(
[
'user-lpa-actor-token' => $this->userLpaActorToken,
'date' => 'date',
'lpa' => $this->lpa,
'actor' => null,
]
),
self::LPA_SERVICE_GET_LPA_BY_ID
)
);
$this->ui->clickLink('Remove LPA');
$this->ui->assertPageAddress('/lpa/remove-lpa');
}

/**
* @When /^I request to view an LPA which has a donor signature before 2016$/
* @When /^I request to view an LPA which has a trust corporation added$/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getLpaById(string $userToken, string $actorLpaToken): ?ArrayObje

$lpaData = $this->apiClient->httpGet('/v1/lpas/' . $actorLpaToken);

$lpaData = isset($lpaData['actor']) ? ($this->parseLpaData)($lpaData) : null;
$lpaData = ($this->parseLpaData)($lpaData);

if ($lpaData['lpa'] !== null) {
$this->logger->info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public function __invoke(array $data): ArrayObject
}
break;
case 'actor':
$data['actor']['details'] = $this->lpaFactory->createCaseActorFromData($dataItem['details']);
if ($data['actor'] !== null) {
$data['actor']['details'] = $this->lpaFactory->createCaseActorFromData($dataItem['details']);
}
break;
case 'iap':
$data['iap'] = $this->imagesFactory->createFromData($dataItem);
Expand Down

0 comments on commit 38c7bd6

Please sign in to comment.