function UserLoginHttpTest::assertHttpResponseWithMessage

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

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
Test the per-user login flood control.

File

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

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

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