function UserLoginHttpTest::assertHttpResponse

Same name and namespace in other branches
  1. 8.9.x core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\UserLoginHttpTest::assertHttpResponse()
  2. 10 core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\UserLoginHttpTest::assertHttpResponse()
  3. 11.x core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\UserLoginHttpTest::assertHttpResponse()

Checks a response for status code and body.

@internal

Parameters

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

int $expected_code: The expected status code.

string $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::doTestLogoutCsrfProtection in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests csrf protection of User Logout route for given serialization format.

File

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

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

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

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