diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php index d9c4607..71b1a08 100644 --- a/core/modules/rest/src/Tests/RESTTestBase.php +++ b/core/modules/rest/src/Tests/RESTTestBase.php @@ -73,13 +73,11 @@ protected function setUp() { * The body for POST and PUT. * @param string $mime_type * The MIME type of the transmitted content. - * @param array $request_headers - * Some additional request headers. * * @return string * The content returned from the request. */ - protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL, $request_headers = []) { + protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL) { if (!isset($mime_type)) { $mime_type = $this->defaultMimeType; } @@ -120,11 +118,10 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL, $ CURLOPT_POSTFIELDS => $body, CURLOPT_URL => $url, CURLOPT_NOBODY => FALSE, - CURLOPT_HTTPHEADER => array_merge( - array( + CURLOPT_HTTPHEADER => array( 'Content-Type: ' . $mime_type, 'X-CSRF-Token: ' . $token, - ), $request_headers), + ), ); break; @@ -176,9 +173,6 @@ protected function httpRequest($url, $method, $body = NULL, $mime_type = NULL, $ $this->verbose($method . ' request to: ' . $url . '
Code: ' . curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE) . - '
Request headers: ' . nl2br(print_r($curl_options[CURLOPT_HTTPHEADER], TRUE)) . - '
Extra headers: ' . nl2br(print_r($request_headers, TRUE)) . - '
Request body: ' . nl2br(print_r($body, TRUE)) . '
Response headers: ' . nl2br(print_r($headers, TRUE)) . '
Response body: ' . $this->responseBody); diff --git a/core/modules/user/src/Controller/UserLoginController.php b/core/modules/user/src/Controller/UserLoginController.php index a8eddc1..f25b07e 100644 --- a/core/modules/user/src/Controller/UserLoginController.php +++ b/core/modules/user/src/Controller/UserLoginController.php @@ -15,6 +15,9 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +/** + * Provides controllers for login, login status and logout. + */ class UserLoginController extends ControllerBase implements ContainerInjectionInterface { /** diff --git a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php index 4c865fd..a7335be 100644 --- a/core/modules/user/tests/src/Functional/UserLoginHttpTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginHttpTest.php @@ -7,6 +7,11 @@ use Drupal\user\Controller\UserLoginController; use GuzzleHttp\Cookie\CookieJar; +/** + * Tests login via direct HTTP. + * + * @group user + */ class UserLoginHttpTest extends BrowserTestBase { /** @@ -14,12 +19,26 @@ class UserLoginHttpTest extends BrowserTestBase { */ protected $cookies; + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); $this->cookies = new CookieJar(); } + /** + * Executes a login HTTP request. + * + * @param string $name + * The username. + * @param $pass + * The user password. + * + * @return \Psr\Http\Message\ResponseInterface + * The HTTP response. + */ protected function loginRequest($name, $pass) { $user_login_url = Url::fromRoute('user.login.json') ->setRouteParameter('_format', 'json')