From 3a7d5103bc81cb20bec12ee692fbae2d55be6585 Mon Sep 17 00:00:00 2001 From: mrded Date: Sat, 31 Aug 2013 16:23:37 +0100 Subject: [PATCH] Convert _session_test_id() to a new style controller --- .../Controller/SessionTestController.php | 42 ++++++++++++++++++++++ .../tests/modules/session_test/session_test.module | 18 +--------- .../modules/session_test/session_test.routing.yml | 6 ++++ 3 files changed, 49 insertions(+), 17 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..f0bbeef --- /dev/null +++ b/core/modules/system/tests/modules/session_test/lib/Drupal/session_test/Controller/SessionTestController.php @@ -0,0 +1,42 @@ + MENU_CALLBACK, ); $items['session-test/id'] = array( - 'title' => 'Session ID', - 'page callback' => '_session_test_id', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, + 'route_name' => 'session_test_id', ); $items['session-test/id-from-cookie'] = array( 'title' => 'Session ID from cookie', @@ -95,19 +92,6 @@ function _session_test_no_set($value) { } /** - * Menu callback: print the current session ID. - */ -function _session_test_id() { - // Set a value in $_SESSION, so that drupal_session_commit() will start - // a session. - $_SESSION['test'] = 'test'; - - drupal_session_commit(); - - return 'session_id:' . session_id() . "\n"; -} - -/** * Menu callback: print the current session ID as read from the cookie. */ function _session_test_id_from_cookie() { 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..6bda8a1 --- /dev/null +++ b/core/modules/system/tests/modules/session_test/session_test.routing.yml @@ -0,0 +1,6 @@ +session_test_id: + pattern: '/session-test/id' + defaults: + _controller: '\Drupal\session_test\Controller\SessionTestController::getId' + requirements: + _permission: 'access content' -- 1.7.12.4 (Apple Git-37)