diff --git a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php index 0ab6ee7..a60d82b 100644 --- a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php @@ -107,7 +107,7 @@ public function testLogin() { $user_login_status_url->setAbsolute(); $response = $client->post($user_login_status_url->toString()); - $this->checkResponse($response, 200, UserAuthenticationController::LOGGED_OUT); + $this->assertResponse($response, 200, UserAuthenticationController::LOGGED_OUT); // Flooded. $this->config('user.flood') @@ -115,16 +115,16 @@ public function testLogin() { ->save(); $response = $this->loginRequest($name, 'wrong-pass', $format); - $this->checkResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); + $this->assertResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); $response = $this->loginRequest($name, 'wrong-pass', $format); - $this->checkResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); + $this->assertResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); $response = $this->loginRequest($name, 'wrong-pass', $format); - $this->checkResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); + $this->assertResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); $response = $this->loginRequest($name, 'wrong-pass', $format); - $this->checkResponseWithMessage($response, 400, 'Blocked.', $format); + $this->assertResponseWithMessage($response, 400, 'Blocked.', $format); // After testing the flood control we can increase the limit. $this->config('user.flood') @@ -132,13 +132,13 @@ public function testLogin() { ->save(); $response = $this->loginRequest(NULL, NULL, $format); - $this->checkResponseWithMessage($response, 400, 'Missing credentials.', $format); + $this->assertResponseWithMessage($response, 400, 'Missing credentials.', $format); $response = $this->loginRequest(NULL, $pass, $format); - $this->checkResponseWithMessage($response, 400, 'Missing credentials.name.', $format); + $this->assertResponseWithMessage($response, 400, 'Missing credentials.name.', $format); $response = $this->loginRequest($name, NULL, $format); - $this->checkResponseWithMessage($response, 400, 'Missing credentials.pass.', $format); + $this->assertResponseWithMessage($response, 400, 'Missing credentials.pass.', $format); // Blocked. $account @@ -146,17 +146,17 @@ public function testLogin() { ->save(); $response = $this->loginRequest($name, $pass, $format); - $this->checkResponseWithMessage($response, 400, 'The user has not been activated or is blocked.', $format); + $this->assertResponseWithMessage($response, 400, 'The user has not been activated or is blocked.', $format); $account ->activate() ->save(); $response = $this->loginRequest($name, 'garbage', $format); - $this->checkResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); + $this->assertResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); $response = $this->loginRequest('garbage', $pass, $format); - $this->checkResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); + $this->assertResponseWithMessage($response, 400, 'Sorry, unrecognized username or password.', $format); $response = $this->loginRequest($name, $pass, $format); $this->assertEquals(200, $response->getStatusCode()); @@ -178,7 +178,7 @@ public function testLogin() { $this->assertEquals(204, $response->getStatusCode()); $response = $client->post($user_login_status_url->toString(), ['cookies' => $this->cookies]); - $this->checkResponse($response, 200, UserAuthenticationController::LOGGED_OUT); + $this->assertResponse($response, 200, UserAuthenticationController::LOGGED_OUT); $this->resetFlood(); } @@ -267,7 +267,7 @@ public function testGlobalLoginFloodControl() { // IP limit has reached to its limit. Even valid user credentials will fail. $response = $this->loginRequest($user->getUsername(), $user->pass_raw); - $this->checkResponseWithMessage($response, '403', 'Access is blocked because of IP based flood prevention.', 'json'); + $this->assertResponseWithMessage($response, '403', 'Access is blocked because of IP based flood prevention.', 'json'); } /** @@ -284,7 +284,7 @@ protected function config($config_name) { } /** - * Check a response for status code and body. + * Checks a response for status code and body. * * @param \Psr\Http\Message\ResponseInterface $response * The response object. @@ -293,13 +293,13 @@ protected function config($config_name) { * @param mixed $expected_body * The expected response body. */ - protected function checkResponse(ResponseInterface $response, $expected_code, $expected_body) { + protected function assertResponse(ResponseInterface $response, $expected_code, $expected_body) { $this->assertEquals($expected_code, $response->getStatusCode()); $this->assertEquals($expected_body, (string) $response->getBody()); } /** - * Check a response for status code and message. + * Checks a response for status code and message. * * @param \Psr\Http\Message\ResponseInterface $response * The response object. @@ -310,7 +310,7 @@ protected function checkResponse(ResponseInterface $response, $expected_code, $e * @param string $format * The format that the response is encoded in. */ - protected function checkResponseWithMessage(ResponseInterface $response, $expected_code, $expected_message, $format) { + protected function assertResponseWithMessage(ResponseInterface $response, $expected_code, $expected_message, $format) { $this->assertEquals($expected_code, $response->getStatusCode()); $this->assertEquals($expected_message, $this->getResultValue($response, 'message', $format)); }