You are here

protected function UserLoginHttpTest::assertHttpResponse in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\UserLoginHttpTest::assertHttpResponse()

Checks a response for status code and body.

Parameters

\Psr\Http\Message\ResponseInterface $response: The response object.

int $expected_code: The expected status code.

mixed $expected_body: The expected response body.

2 calls to UserLoginHttpTest::assertHttpResponse()
UserLoginHttpTest::doTestLogin in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Do login testing for a given serialization format.
UserLoginHttpTest::testLogoutCsrfProtection in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests csrf protection of User Logout route.

File

core/modules/user/tests/src/Functional/UserLoginHttpTest.php, line 331

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

protected function assertHttpResponse(ResponseInterface $response, $expected_code, $expected_body) {
  $this
    ->assertEquals($expected_code, $response
    ->getStatusCode());
  $this
    ->assertEquals($expected_body, (string) $response
    ->getBody());
}