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
#9 drupal8.url_alter_test.1987892-9.patch2.36 KBdisasm
PASSED: [[SimpleTest]]: [MySQL] 58,085 pass(es).
[ View ]
#9 interdiff.txt824 bytesdisasm
#7 drupal8.url_alter_test.1987892-7.patch2.28 KBdisasm
PASSED: [[SimpleTest]]: [MySQL] 58,373 pass(es).
[ View ]
#7 interdiff.txt1.65 KBdisasm
#4 drupal8.system-module.1987892-4.patch2.14 KBdisasm
PASSED: [[SimpleTest]]: [MySQL] 58,115 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» disasm

Status:Active» Needs review
StatusFileSize
new2.14 KB
PASSED: [[SimpleTest]]: [MySQL] 58,115 pass(es).
[ View ]

conversion patch.

  1. +++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/Controller/URLAlterTestController.php
    @@ -0,0 +1,22 @@
    +class URLAlterTestController {
    +  /**

    This should have a newline in between.

  2. +++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/Controller/URLAlterTestController.php
    @@ -0,0 +1,22 @@
    +    print 'current_path=' . current_path() . ' request_path=' . request_path();
    +    exit;

    You should return just a response object.

  3. +++ b/core/modules/system/tests/modules/url_alter_test/url_alter_test.module
    @@ -11,17 +11,8 @@
       $items['url-alter-test/foo'] = array(
         'title' => 'Foo',
    -    'page callback' => 'url_alter_test_foo',
    -    'access arguments' => array('access content'),
    +    'route_name' => 'url_alter_test_foo',
         'type' => MENU_CALLBACK,
       );

    this hook can be removed as it is, because MENU_CALLBACKs are directly replaced with controllers.

Status:Needs review» Needs work

.

Status:Needs work» Needs review
StatusFileSize
new1.65 KB
new2.28 KB
PASSED: [[SimpleTest]]: [MySQL] 58,373 pass(es).
[ View ]

Attached patch addresses comments in #5.

+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/Controller/URLAlterTestController.php
@@ -0,0 +1,24 @@
+   *
+   */

Let's also add a simple @return on there.

StatusFileSize
new824 bytes
new2.36 KB
PASSED: [[SimpleTest]]: [MySQL] 58,085 pass(es).
[ View ]

Status:Needs review» Reviewed & tested by the community

Thank you.

Status:Reviewed & tested by the community» Fixed

Committed 80d9f5c and pushed to 8.x. Thanks!

At some point we need to replace current_path and request_path with stuff based on Symfony's Request object.

+++ b/core/modules/system/tests/modules/url_alter_test/lib/Drupal/url_alter_test/Controller/URLAlterTestController.php
@@ -0,0 +1,26 @@
+    return new Response('current_path=' . current_path() . ' request_path=' . request_path());

I think we should use the Request to get the currecnt path. The function uses drupal_container()->get('request')->attributes->get('_system_path')

Automatically closed -- issue fixed for 2 weeks with no activity.