From 5cc0db9668afffeeec88df3b26c2a074c5b739b2 Mon Sep 17 00:00:00 2001 From: mrded Date: Sat, 31 Aug 2013 17:08:45 +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..ada2d16 --- /dev/null +++ b/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php @@ -0,0 +1,30 @@ +cookies->get(session_name()) . "\n"; + } +} diff --git a/core/modules/system/tests/modules/session_test/session_test.module b/core/modules/system/tests/modules/session_test/session_test.module index b6e1a53..d003498 100644 --- a/core/modules/system/tests/modules/session_test/session_test.module +++ b/core/modules/system/tests/modules/session_test/session_test.module @@ -17,10 +17,7 @@ function session_test_menu() { 'type' => 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)