function UserLoginHttpTest::assertHttpResponseWithMessage

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

Checks a response for status code and message.

@internal

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::doTestGlobalLoginFloodControl in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests the global login flood control for a given serialization format.
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::doTestPerUserLoginFloodControl in core/modules/user/tests/src/Functional/UserLoginHttpTest.php
Tests the per-user login flood control for a given serialization format.

File

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

Class

UserLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\user\Functional

Code

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

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