protected function UserLoginHttpTest::getResultValue in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Functional/UserLoginHttpTest.php \Drupal\Tests\user\Functional\UserLoginHttpTest::getResultValue()
Gets a value for a given key from the response.
Parameters
\Psr\Http\Message\ResponseInterface $response: The response object.
string $key: The key for the value.
string $format: The encoded format.
Return value
mixed The value for the key.
1 call to UserLoginHttpTest::getResultValue()
- UserLoginHttpTest::assertHttpResponseWithMessage in core/
modules/ user/ tests/ src/ Functional/ UserLoginHttpTest.php - Checks a response for status code and message.
File
- core/
modules/ user/ tests/ src/ Functional/ UserLoginHttpTest.php, line 267
Class
- UserLoginHttpTest
- Tests login and password reset via direct HTTP.
Namespace
Drupal\Tests\user\FunctionalCode
protected function getResultValue(ResponseInterface $response, $key, $format) {
$decoded = $this->serializer
->decode((string) $response
->getBody(), $format);
if (is_array($decoded)) {
return $decoded[$key];
}
else {
return $decoded->{$key};
}
}