Part of #1971384: [META] Convert page callbacks to controllers

For instructions on how to convert a page callback into a controller, see the WSCCI Conversion Guide.

Files: 
CommentFileSizeAuthor
#15 drupal8.theme_test_alter.1987592-15.patch3.5 KBdisasm
PASSED: [[SimpleTest]]: [MySQL] 59,007 pass(es).
[ View ]
#15 interdiff.txt1.08 KBdisasm
#10 drupal8.theme_test.1987592-10.patch5.18 KBdisasm
FAILED: [[SimpleTest]]: [MySQL] 58,475 pass(es), 0 fail(s), and 6 exception(s).
[ View ]
#10 interdiff.txt1.3 KBdisasm
#8 drupal8.theme_test.1987592-8.patch3.29 KBdisasm
PASSED: [[SimpleTest]]: [MySQL] 58,011 pass(es).
[ View ]
#6 drupal8.system-module.1987592-6.patch3.1 KBmparker17
PASSED: [[SimpleTest]]: [MySQL] 58,504 pass(es).
[ View ]
#6 interdiff.txt1.22 KBmparker17
#4 system-theme_test-convert_to_controller-1987592-4.patch2.66 KBmparker17
PASSED: [[SimpleTest]]: [MySQL] 58,055 pass(es).
[ View ]

Comments

Status:Active» Closed (won't fix)

Need to rewrite the whole module to make test sync with current test implementation. For more details, please refer: #1988802: [META] Rewrite test modules in system to provide better unit testing.

Status:Closed (won't fix)» Active

Assigned:Unassigned» mparker17

I will help!

Assigned:mparker17» Unassigned
Status:Active» Needs review
StatusFileSize
new2.66 KB
PASSED: [[SimpleTest]]: [MySQL] 58,055 pass(es).
[ View ]

Try this...

Status:Needs review» Needs work
  1. --- a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
    +++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
    @@ -31,4 +31,17 @@ function functionTemplateOverridden() {
    +    drupal_alter('theme_test_alter', $data);

    If the ThemeTestController would extend the ControllBase you could replace drupal_alter easily by $this->moduleHandler()->alter

  2. +++ b/core/modules/system/tests/modules/theme_test/theme_test.module
    @@ -54,8 +54,7 @@ function theme_test_menu() {
       $items['theme-test/alter'] = array(
         'title' => 'Suggestion',
    -    'page callback' => '_theme_test_alter',
    -    'access callback' => TRUE,
    +    'route_name' => 'theme_test_alter',
         'theme callback' => '_theme_custom_theme',
         'type' => MENU_CALLBACK,
       );

    We can't drop it yet, because there is none replacement for 'theme callback' yet.

StatusFileSize
new1.22 KB
new3.1 KB
PASSED: [[SimpleTest]]: [MySQL] 58,504 pass(es).
[ View ]

Try this...

Status:Needs work» Needs review

StatusFileSize
new3.29 KB
PASSED: [[SimpleTest]]: [MySQL] 58,011 pass(es).
[ View ]

Was rerolling for ContainerInjectionInterface, but the class isn't injecting anything, so removed create() and just extending ControllerBase now.

+++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
@@ -31,4 +23,16 @@ function functionTemplateOverridden() {
+  function themeTestAlter() {

Let's make it public and add a @return statement.

StatusFileSize
new1.3 KB
new5.18 KB
FAILED: [[SimpleTest]]: [MySQL] 58,475 pass(es), 0 fail(s), and 6 exception(s).
[ View ]

Making function public and adding @return to all methods.

Status:Needs review» Needs work
Issue tags:-WSCCI-conversion

The last submitted patch, drupal8.theme_test.1987592-10.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+WSCCI-conversion

#10: drupal8.theme_test.1987592-10.patch queued for re-testing.

+++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
@@ -7,27 +7,62 @@
+   * Menu callback for testing that a theme template overrides a theme function.

Well, technically this is not a menu callback anymore, so maybe call it" Returns a theme template that overrides a theme function."

Status:Needs review» Needs work

The last submitted patch, drupal8.theme_test.1987592-10.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.08 KB
new3.5 KB
PASSED: [[SimpleTest]]: [MySQL] 59,007 pass(es).
[ View ]

last two patches combined a couple issues. This one fixes docs and goes back to what we had at last passing run.

  1. +++ w/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
    @@ -31,4 +26,18 @@ function functionTemplateOverridden() {
    +   * @return string
    +   */

    What about @return string\n Returns a string containing the altered data.

  2. +++ w/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php
    @@ -31,4 +26,18 @@ function functionTemplateOverridden() {
    +  function themeTestAlter() {

    Let's put public in wrong

  3. +++ w/core/modules/system/tests/modules/theme_test/theme_test.module
    @@ -54,8 +54,7 @@ function theme_test_menu() {
       $items['theme-test/alter'] = array(
         'title' => 'Suggestion',
    +++ w/core/modules/system/tests/modules/theme_test/theme_test.routing.yml
    @@ -4,3 +4,10 @@ function_template_override:
    +theme_test_alter:
    +  pattern: 'theme-test/alter'
    +  defaults:
    +    _content: '\Drupal\theme_test\ThemeTestController::themeTestAlter'
    ...
    +    _access: 'TRUE'

    Does it make sense to copy the title from the hook_menu bit to the .routing.yml bit?

Status:Needs review» Closed (duplicate)