diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module index 0c6cdb6..aed0bc6 100644 --- a/core/modules/system/tests/modules/common_test/common_test.module +++ b/core/modules/system/tests/modules/common_test/common_test.module @@ -15,12 +15,6 @@ function common_test_menu() { 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); - $items['common-test/query-string'] = array( - 'title' => 'Test querystring', - 'page callback' => 'common_test_js_and_css_querystring', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, - ); return $items; } @@ -213,18 +207,6 @@ function common_test_library_info() { } /** - * Adds a JavaScript file and a CSS file with a query string appended. - */ -function common_test_js_and_css_querystring() { - drupal_add_library('system', 'drupalSettings'); - drupal_add_js(drupal_get_path('module', 'node') . '/node.js'); - drupal_add_css(drupal_get_path('module', 'node') . '/css/node.admin.css'); - // A relative URI may have a query string. - drupal_add_css('/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2'); - return ''; -} - -/** * Implements hook_cron(). * * System module should handle if a module does not catch an exception and keep diff --git a/core/modules/system/tests/modules/common_test/common_test.routing.yml b/core/modules/system/tests/modules/common_test/common_test.routing.yml index fb27e33..dc61d7a 100644 --- a/core/modules/system/tests/modules/common_test/common_test.routing.yml +++ b/core/modules/system/tests/modules/common_test/common_test.routing.yml @@ -11,3 +11,10 @@ common_test_drupal_render_invalid_keys: _content: '\Drupal\common_test\Controller\CommonTestController::drupalRenderInvalidKeys' requirements: _permission: 'access content' +common_test_js_and_css_querystring: + pattern: '/common-test/query-string' + defaults: + _title: 'Test querystring' + _content: '\Drupal\common_test\Controller\CommonTestController::jsAndCssQuerystring' + requirements: + _permission: 'access content' diff --git a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php index 661b37a..4e76035 100644 --- a/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php +++ b/core/modules/system/tests/modules/common_test/lib/Drupal/common_test/Controller/CommonTestController.php @@ -73,4 +73,19 @@ public function drupalRenderInvalidKeys() { return drupal_render($element); } + /** + * Adds a JavaScript file and a CSS file with a query string appended. + * + * @return string + * An empty string. + */ + public function jsAndCssQuerystring() { + drupal_add_library('system', 'drupalSettings'); + drupal_add_js(drupal_get_path('module', 'node') . '/node.js'); + drupal_add_css(drupal_get_path('module', 'node') . '/css/node.admin.css'); + // A relative URI may have a query string. + drupal_add_css('/' . drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2'); + return ''; + } + }