When a language prefix is set for the english language ('en') on the simpletest 'host' site and URL language detection is enabled, the Translation tests (among some others) fail, because they get referred to a path with the prefix.

Because the prefix is not configured in the simpletest database, the path is then not found.

Translation functionality
367 passes, 251 fails, 217 exceptions, and 155 debug messages

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stevel created an issue. See original summary.

Stevel’s picture

URL language detection enabled. Other translation.test 57 TranslationTestCase->setUp() Pass
GET http://<path omitted>/en/user/logout returned 404 (6.48 KB).

Stevel’s picture

The problem seems to be with drupal_static_reset('locale_url_outbound_alter');.
Before calling this, url() produces correct urls(without /en/ prefix), after it is called, the prefix appears.

Stevel’s picture

Title: Translation tests fail on site with english language prefix » Translation tests fail on site with english language prefix (global $language_url is not reset in tests)
Assigned: Unassigned » Stevel

I've found the root cause for this: the $language_url global variable isn't reset for the testing environment. I'll roll a patch for this.

Stevel’s picture

Status: Active » Needs review
FileSize
3.13 KB

Patch attached that stores the $language_url global when preparing the environment, and restoring it on tearDown().

Pol’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Drupal 7.60 target

Hi,

I will tag this for Drupal 7.60, hopefully Fabianx will review it asap I guess. (@Fabianx: feel free to remove the tag if this is not the way to proceed, sorry in advance if it is the case)

I really think that indeed, this should be committed so we can have better tests.

Thanks!

David_Rothstein’s picture

Issue tags: -Drupal 7.60 target +Pending Drupal 7 commit

This looks good to me.

I don't see any reason it needs to wait for Drupal 7.60 - it's just a straight bugfix and seems non-risky. I guess there's a theoretical chance some test out there is relying on the current behavior? (But I don't think they should be, and even if they are, the worst that happens is a broken test.)

I guess I'll let one of the other committers make the final decision, though.

  • 856aa8c committed on 7.x
    Issue #2724773 by Stevel: Translation tests fail on site with english...
stefan.r’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit

Committed and pushed to 7.x, thanks!

Status: Fixed » Closed (fixed)

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