diff --git a/core/modules/user/src/Controller/UserController.php b/core/modules/user/src/Controller/UserController.php index eba37a9f644d42bce59baa8ecdf050f24f3acd88..2bbfe345e73c13168c7ddc4673a36b68a29d6085 100644 --- a/core/modules/user/src/Controller/UserController.php +++ b/core/modules/user/src/Controller/UserController.php @@ -317,7 +317,7 @@ public function confirmCancel(UserInterface $user, $timestamp = 0, $hashed_pass // Since user_cancel() is not invoked via Form API, batch processing // needs to be invoked manually and should redirect to the front page // after completion. - return batch_process(''); + return batch_process(''); } else { $this->messenger()->addError($this->t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.')); diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index 503100c3bcf2984e5f85fa26490abbd9540e1225..869cd37bdd5af4125042b8ae0e197adb8342904d 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -251,6 +251,12 @@ public function testUserBlockUnpublish() { // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); + // Confirm that the user was redirected to the front page. + $this->assertSession()->addressEquals(''); + $this->assertSession()->statusCodeEquals(200); + // Confirm that the confirmation message made it through to the end user. + $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getUsername()]), "Confirmation message displayed to user."); + $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); $this->assertTrue($account->isBlocked(), 'User has been blocked.'); @@ -266,9 +272,6 @@ public function testUserBlockUnpublish() { $storage->resetCache([$comment->id()]); $comment = $storage->load($comment->id()); $this->assertFalse($comment->isPublished(), 'Comment of the user has been unpublished.'); - - // Confirm that the confirmation message made it through to the end user. - $this->assertRaw(t('%name has been disabled.', ['%name' => $account->getUsername()]), "Confirmation message displayed to user."); } /**