function UserControllerTest::testUserEditPage

Same name in other branches
  1. 10 core/modules/user/tests/src/Kernel/Controller/UserControllerTest.php \Drupal\Tests\user\Kernel\Controller\UserControllerTest::testUserEditPage()
  2. 11.x core/modules/user/tests/src/Kernel/Controller/UserControllerTest.php \Drupal\Tests\user\Kernel\Controller\UserControllerTest::testUserEditPage()

Tests the redirection to a user edit page.

@covers ::userEditPage

File

core/modules/user/tests/src/Kernel/Controller/UserControllerTest.php, line 61

Class

UserControllerTest
Tests for the User controller.

Namespace

Drupal\Tests\user\Kernel\Controller

Code

public function testUserEditPage() {
    $response = $this->userController
        ->userEditPage();
    // Ensure the response is directed to the correct user edit page.
    $edit_url = Url::fromRoute('entity.user.edit_form', [
        'user' => $this->user
            ->id(),
    ])
        ->setAbsolute()
        ->toString();
    $this->assertEquals($edit_url, $response->getTargetUrl());
    $this->assertEquals(302, $response->getStatusCode());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.