Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#5 | 2724773-simpletest-language-url-5.patch | 3.13 KB | Stevel |
Comments
Comment #2
Stevel CreditAttribution: Stevel commentedComment #3
Stevel CreditAttribution: Stevel commentedThe 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.
Comment #4
Stevel CreditAttribution: Stevel commentedI'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.
Comment #5
Stevel CreditAttribution: Stevel commentedPatch attached that stores the $language_url global when preparing the environment, and restoring it on tearDown().
Comment #6
PolHi,
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!
Comment #7
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedThis 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.
Comment #9
stefan.r CreditAttribution: stefan.r commentedCommitted and pushed to 7.x, thanks!