function LinksetControllerTestBase::doRequest
Same name in other branches
- 10 core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php \Drupal\Tests\system\Functional\Menu\LinksetControllerTestBase::doRequest()
Sends a request to the kernel and makes basic response assertions.
Only to be used when the expected response is a linkset response.
Parameters
string $method: HTTP method.
\Drupal\Core\Url $url: URL to request.
int $expected_status: The expected status code.
\Drupal\user\UserInterface $account: A user account whose credentials should be used to authenticate the request.
Return value
\GuzzleHttp\Psr7\Response The response object.
8 calls to LinksetControllerTestBase::doRequest()
- LinksetControllerMultiLingualTest::testBasicMultilingualFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerMultiLingualTest.php - Test core functions of the linkset for multilingual behavior.
- LinksetControllerMultiLingualTest::testDefaultMultilingualFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerMultiLingualTest.php - Test core functions of the linkset for multilingual behavior.
- LinksetControllerTest::testAccess in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTest.php - Test the access control functionality of the linkset endpoint.
- LinksetControllerTest::testBasicFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTest.php - Test core functions of the linkset endpoint.
- LinksetControllerTest::testCacheability in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTest.php - Test the cacheability of the linkset endpoint.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTestBase.php, line 72
Class
- LinksetControllerTestBase
- A base class for implementing LinksetController tests.
Namespace
Drupal\Tests\system\Functional\MenuCode
protected function doRequest(string $method, Url $url, $expected_status = 200, ?UserInterface $account = NULL) : Response {
$request_options = [];
if (!is_null($account)) {
$credentials = $account->name->value . ':' . $account->passRaw;
$request_options[RequestOptions::HEADERS] = [
'Authorization' => 'Basic ' . base64_encode($credentials),
];
}
$response = $this->makeApiRequest($method, $url, $request_options);
$this->assertSame($expected_status, $response->getStatusCode(), (string) $response->getBody());
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.