Commit 240586c0 authored by catch's avatar catch

Issue #2729247 by andypost: Replace remaining $request->get() usage to prepare core for Symfony 3

parent ff28f525
......@@ -92,7 +92,7 @@ public function onException(GetResponseForExceptionEvent $event) {
$form_state = $exception->getFormState();
// Set the build ID from the request as the old build ID on the form.
$form['#build_id_old'] = $request->get('form_build_id');
$form['#build_id_old'] = $request->request->get('form_build_id');
try {
$response = $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, []);
......
......@@ -80,7 +80,7 @@ public function registerFormat($format, $mime_type) {
protected function getContentType(Request $request) {
// AJAX iframe uploads need special handling, because they contain a JSON
// response wrapped in <textarea>.
if ($request->get('ajax_iframe_upload', FALSE)) {
if ($request->request->get('ajax_iframe_upload', FALSE)) {
return 'iframeupload';
}
......
......@@ -91,7 +91,7 @@ public static function create(ContainerInterface $container, array $configuratio
* {@inheritdoc}
*/
public function getLangcode(Request $request = NULL) {
$langcode = $request->get(static::QUERY_PARAMETER);
$langcode = $request->query->get(static::QUERY_PARAMETER);
$language_enabled = array_key_exists($langcode, $this->languageManager->getLanguages());
return $language_enabled ? $langcode : NULL;
......
......@@ -79,7 +79,7 @@ public function view(Request $request, SearchPageInterface $entity) {
// and we don't want to build the results based on last time's request.
$build['#cache']['contexts'][] = 'url.query_args:keys';
if ($request->query->has('keys')) {
$keys = trim($request->get('keys'));
$keys = trim($request->query->get('keys'));
$plugin->setSearch($keys, $request->query->all(), $request->attributes->all());
}
......
......@@ -60,7 +60,7 @@ public static function create(ContainerInterface $container) {
* the token is invalid.
*/
public function uninstall(Request $request) {
$theme = $request->get('theme');
$theme = $request->query->get('theme');
$config = $this->config('system.theme');
if (isset($theme)) {
......@@ -102,7 +102,7 @@ public function uninstall(Request $request) {
* the token is invalid.
*/
public function install(Request $request) {
$theme = $request->get('theme');
$theme = $request->query->get('theme');
if (isset($theme)) {
try {
......
......@@ -38,9 +38,9 @@
}
if (Settings::get('rebuild_access', FALSE) ||
($request->get('token') && $request->get('timestamp') &&
((REQUEST_TIME - $request->get('timestamp')) < 300) &&
Crypt::hashEquals(Crypt::hmacBase64($request->get('timestamp'), Settings::get('hash_salt')), $request->get('token'))
($request->query->get('token') && $request->query->get('timestamp') &&
((REQUEST_TIME - $request->query->get('timestamp')) < 300) &&
Crypt::hashEquals(Crypt::hmacBase64($request->query->get('timestamp'), Settings::get('hash_salt')), $request->query->get('token'))
)) {
// Clear the APCu cache to ensure APCu class loader is reset.
if (function_exists('apcu_clear_cache')) {
......
......@@ -46,7 +46,7 @@ protected function setUp() {
*/
public function testAjaxIframeUpload() {
$request = new Request();
$request->attributes->set('ajax_iframe_upload', '1');
$request->request->set('ajax_iframe_upload', '1');
$this->assertSame('iframeupload', $this->contentNegotiation->getContentType($request));
}
......@@ -101,9 +101,11 @@ public function testHandle() {
$request->setRequestFormat('html')->shouldBeCalled();
// Some getContentType calls we don't really care about but have to mock.
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_data = $this->prophesize(ParameterBag::class);
$request_data->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
$request_mock->request = $request_data->reveal();
// Calling kernel app with default arguments.
$this->app->handle($request_mock, HttpKernelInterface::MASTER_REQUEST, TRUE)
......@@ -126,9 +128,11 @@ public function testSetFormat() {
// Some calls we don't care about.
$request->setRequestFormat('html')->shouldBeCalled();
$request->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_data = $this->prophesize(ParameterBag::class);
$request_data->get('ajax_iframe_upload', FALSE)->shouldBeCalled();
$request_mock = $request->reveal();
$request_mock->query = new ParameterBag([]);
$request_mock->request = $request_data->reveal();
// Trigger handle.
$this->contentNegotiation->registerFormat('david', 'geeky/david');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment