From 12226d9c4ca2405f18f5c736c494c50932ab80f9 Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 14 Sep 2013 23:51:42 -0700 Subject: [PATCH] Issue #1987804 by disasm, dawehner: Convert plugin_test_definitions() to a new style controller. --- .../plugin_test/Controller/PluginTest.php | 34 +++++++++++++++++++ .../modules/plugin_test/plugin_test.module | 22 +----------- .../plugin_test/plugin_test.routing.yml | 6 ++++ 3 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Controller/PluginTest.php create mode 100644 core/modules/system/tests/modules/plugin_test/plugin_test.routing.yml diff --git a/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Controller/PluginTest.php b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Controller/PluginTest.php new file mode 100644 index 00000000000..5ec7fa41ec1 --- /dev/null +++ b/core/modules/system/tests/modules/plugin_test/lib/Drupal/plugin_test/Controller/PluginTest.php @@ -0,0 +1,34 @@ +getDefinitions() as $plugin_id => $definition) { + $output[$plugin_id] = array( + '#markup' => $definition['label'], + ); + } + return $output; + } + +} diff --git a/core/modules/system/tests/modules/plugin_test/plugin_test.module b/core/modules/system/tests/modules/plugin_test/plugin_test.module index 27fc6144658..036cd97e10e 100644 --- a/core/modules/system/tests/modules/plugin_test/plugin_test.module +++ b/core/modules/system/tests/modules/plugin_test/plugin_test.module @@ -1,7 +1,5 @@ TRUE, - 'page callback' => 'plugin_test_definitions', + 'route_name' => 'plugin_test_definitions', ); return $items; } - -/** - * A simple page callback that prints plugin labels for testing. - * - * @return array - * A simple renderable array of plugin labels. - */ -function plugin_test_definitions() { - $manager = new CachedMockBlockManager(); - $output = array(); - foreach($manager->getDefinitions() as $plugin_id => $definition) { - $output[$plugin_id] = array( - '#markup' => $definition['label'], - ); - } - return $output; -} diff --git a/core/modules/system/tests/modules/plugin_test/plugin_test.routing.yml b/core/modules/system/tests/modules/plugin_test/plugin_test.routing.yml new file mode 100644 index 00000000000..16f05a9d0cc --- /dev/null +++ b/core/modules/system/tests/modules/plugin_test/plugin_test.routing.yml @@ -0,0 +1,6 @@ +plugin_definition_test: + pattern: '/plugin_definition_test' + defaults: + _content: '\Drupal\plugin_test\Controller\PluginTest::testDefinitions' + requirements: + _access: 'TRUE'