function UserLoginHttpTest::assertHttpResponse

Same name and namespace in other branches
  1. 9 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.

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
Test csrf protection of User Logout route.

File

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

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());
}

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