From c0f84f423693365c443ed82ae8f268c8676bb797 Mon Sep 17 00:00:00 2001 From: mrded Date: Sat, 31 Aug 2013 16:45:29 +0100 Subject: [PATCH] Convert _session_test_id_from_cookie() to a new style controller --- .../Controller/SessionTestController.php | 30 ++++++++++++++++++++++ .../tests/modules/session_test/session_test.module | 12 +-------- .../modules/session_test/session_test.routing.yml | 6 +++++ 3 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php create mode 100644 core/modules/system/tests/modules/session_test/session_test.routing.yml diff --git a/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php b/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php new file mode 100644 index 0000000..28f9e05 --- /dev/null +++ b/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php @@ -0,0 +1,30 @@ + MENU_CALLBACK, ); $items['session-test/id-from-cookie'] = array( - 'title' => 'Session ID from cookie', - 'page callback' => '_session_test_id_from_cookie', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, + 'route_name' => 'session_test_id_from_cookie', ); $items['session-test/set/%'] = array( 'title' => 'Set session value', @@ -108,13 +105,6 @@ function _session_test_id() { } /** - * Menu callback: print the current session ID as read from the cookie. - */ -function _session_test_id_from_cookie() { - return 'session_id:' . $_COOKIE[session_name()] . "\n"; -} - -/** * Menu callback, sets a message to me displayed on the following page. */ function _session_test_set_message() { diff --git a/core/modules/system/tests/modules/session_test/session_test.routing.yml b/core/modules/system/tests/modules/session_test/session_test.routing.yml new file mode 100644 index 0000000..759969d --- /dev/null +++ b/core/modules/system/tests/modules/session_test/session_test.routing.yml @@ -0,0 +1,6 @@ +session_test_id_from_cookie: + pattern: '/session-test/id-from-cookie' + defaults: + _controller: '\Drupal\session_test\Controller\SessionTestController::getIdFromCookie' + requirements: + _permission: 'access content' -- 1.7.12.4 (Apple Git-37)