function RestLoginHttpTest::assertHttpResponseWithMessage

Same name and namespace in other branches
  1. main core/modules/rest/tests/src/Functional/RestLoginHttpTest.php \Drupal\Tests\rest\Functional\RestLoginHttpTest::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.

File

core/modules/rest/tests/src/Functional/RestLoginHttpTest.php, line 359

Class

RestLoginHttpTest
Tests login and password reset via direct HTTP.

Namespace

Drupal\Tests\rest\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.