Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rhristov created an issue. See original summary.

rhristov’s picture

Status: Active » Needs review
FileSize
1.28 KB

It is because in resolvedPathIsHomePath $resolved_path is absolute url and $home_path is relative. Applying a patch that is converting the home path to absolute url.

baikho’s picture

After applying the patch, isHomePath still returns FALSE, because the newly assigned variable $home_url doesn't resolve to a URL. Subsequently then the end comparison still fails.

See re-rolled patch which fixes $home_url to a URL string with manual test through Postman for which ie. node/3 is set to be the front page.

e0ipso’s picture

Can we add a test that fails before the code fix, and then passes after the code fix?

baikho’s picture

@e0ipso thanks for your review.

I've added a testHomPathCheck to the DecoupledRouterFunctionalTest class. (See re-rolled patch)

baikho’s picture

e0ipso’s picture

Thanks so much for this test. Only a minor question:

+++ b/tests/src/Functional/DecoupledRouterFunctionalTest.php
@@ -240,6 +240,60 @@ class DecoupledRouterFunctionalTest extends BrowserTestBase {
+    $admin_user = $this->drupalCreateUser([
+      'administer nodes',
+      'bypass node access',
+    ]);
+    $this->drupalLogin($admin_user);

Why do we need to login as an admin user for this test?

baikho’s picture

FileSize
3.18 KB
634 bytes

Good point, no need for it. See re-rolled.

rhristov’s picture

Seems like when the site is multilanguage and for its detection is used domain based URL negotiator, as in my case, the URL is absolute without explicitly defining it, as it is done in #3.

Good catch Baik Ho.

  • e0ipso committed 7e5d405 on 8.x-1.x authored by baikho
    Issue #3036392 by baikho, rhristov, e0ipso: When the provided path is...
e0ipso’s picture

Status: Needs review » Fixed

Merged!

Status: Fixed » Closed (fixed)

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