You are here

protected function UserLoginHttpTest::assertHttpResponseWithMessage 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::assertHttpResponseWithMessage()

Checks a response for status code and message.

Parameters

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

int $expected_code: The expected status code.

string $expected_message: The expected message encoded in response.

string $format: The format that the response is encoded in.

4 calls to UserLoginHttpTest::assertHttpResponseWithMessage()
UserLoginHttpTest::doTestLogin in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Do login testing for a given serialization format.
UserLoginHttpTest::doTestPasswordReset in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Do password reset testing for given format and account.
UserLoginHttpTest::testGlobalLoginFloodControl in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests the global login flood control.
UserLoginHttpTest::testPerUserLoginFloodControl in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests the per-user login flood control.

File

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

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

protected function assertHttpResponseWithMessage(ResponseInterface $response, $expected_code, $expected_message, $format = 'json') {
  $this
    ->assertEquals($expected_code, $response
    ->getStatusCode());
  $this
    ->assertEquals($expected_message, $this
    ->getResultValue($response, 'message', $format));
}