public function LanguageTestController::testSubRequest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/language/tests/language_test/src/Controller/LanguageTestController.php \Drupal\language_test\Controller\LanguageTestController::testSubRequest()
Uses a sub request to retrieve the 'user' page.
Return value
\Symfony\Component\HttpFoundation\Response The kernels response to the sub request.
1 string reference to 'LanguageTestController::testSubRequest'
- language_test.routing.yml in core/
modules/ language/ tests/ language_test/ language_test.routing.yml - core/modules/language/tests/language_test/language_test.routing.yml
File
- core/
modules/ language/ tests/ language_test/ src/ Controller/ LanguageTestController.php, line 125 - Contains \Drupal\language_test\Controller\LanguageTestController.
Class
- LanguageTestController
- Controller routines for language_test routes.
Namespace
Drupal\language_test\ControllerCode
public function testSubRequest() {
$request = Request::createFromGlobals();
$server = $request->server
->all();
if (basename($server['SCRIPT_FILENAME']) != basename($server['SCRIPT_NAME'])) {
// We need this for when the test is executed by run-tests.sh.
// @todo Remove this once run-tests.sh has been converted to use a Request
// object.
$server['SCRIPT_FILENAME'] = $server['SCRIPT_NAME'];
$base_path = ltrim($server['REQUEST_URI'], '/');
}
else {
$base_path = $request
->getBasePath();
}
$sub_request = Request::create($base_path . '/user', 'GET', $request->query
->all(), $request->cookies
->all(), array(), $server);
return $this->httpKernel
->handle($sub_request, HttpKernelInterface::SUB_REQUEST);
}