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.
hi,
i have the following code simpletest code snippet:
//my site is multilingual, base = english, additional = german
$this->drupalGet('apartments/vienna/test'); //opens a german-only node
$this->clickLink(t('Send Request'));
this will open a link to http://example.com/de/de/xyz
the clicked link is generated via
l(t('Send Request'), 'xyz);
i don't really get, why this happens. any hints would be very appreciated!
thanks josef
Comment | File | Size | Author |
---|---|---|---|
#11 | simpletest_url_locale2.patch | 1.02 KB | dasjo |
#9 | simpletest_url_locale.patch | 1008 bytes | dasjo |
Comments
Comment #1
boombatower CreditAttribution: boombatower commentedI am not clear on what is going on, could you attempt to clarify the issue. Sorry, if I am missing something obvious.
Thanks.
Comment #2
dasjohi,
well as i explain above, i run a test on a multilingual site.
when executing clickLink within the test, it will open a corrupted URL, having the language-code double as "http://example.com/de/de/xyz".
outside the test, the clicked links work without any problem, so i guess that simpletest somehow causes the language system to inject the language code twice!?
i know this is hard to debug, but i really would like to see if this can be fixed...
thanks josef
Comment #3
dasjothe same happens to me with this->drupalPost :(
any help would be appreciated
Comment #4
dasjoComment #5
dasjoComment #6
dasjothe problem seems to happen with the "path prefix with language fallback" option only
steps to reproduce:
* install drupal 6 + cck + i18n
* enable content + content translation + simpletest
* activate translation for page content type
* languages - add german, language negociation is "path prefix with language fallback"
* activate translation for page content type
* add "my page" in english and translate it to "meine seite" in german (node/2 and node/3 in my case)
* execute the following simpletest
so here are the simpletest results:
$this->drupalGet('node/1'); worked, ok, but then...
we see that with $this->clickLink('Deutsch'); wrong url is generated. after the domain name worktest, we have "/en/de/node/2" which means, that there is both an english + a german language code. therefore we encounter a 404 error and the test fails...
with language negotiation set to "none", the test will just work:
assigning this to the i18n queue now.
if you could provide me a hint how to avoid this issue, i would like to submit a patch
Comment #7
dasjoComment #8
dasjodebugging this->drupalLogin(...);
in drupal_web_test_case.php
...
$path = "/en/user";
call getAbsoluteUrl($path);
...
$path = url($path, $options);
now, $path is "/en/en/user"
not sure yet, how to avoid this?
Comment #9
dasjoboombatower told me, that this problem is caused by simpletests url handling / the browser it uses.
the http://drupal.org/project/browser should help us overcome this for the future (incomplete d7 draft exists at the moment)
in order to address my specific issue with the language code being put twice in the url i wrote the following patch
Comment #10
klausiwe use spaces instead of tabs
Powered by Dreditor.
Comment #11
dasjoyeah tanks, hope this one's better :)
Comment #12
dasjoComment #13
Dave ReidI think your problem here is in your test case, the function tearDown() needs to call
parent::tearDown()
.Comment #14
dasjo@dave reid: thanks for the hint for teatDown(), but this doesn't affect the issue / the behaviour of links being executed within the test.
Comment #15
kenorb CreditAttribution: kenorb commentedTested and it works.
There is also the case, when links to the files are wrong, like: /en/files/simpletest/verbose/Index-1.html
but probably it's a different issue.
I've reported it here: #1844500: Path to files are prefixed with 'en' (en/files)
These two were working correctly in the previous versions (before back-porting from D7)
Comment #17
kenorb CreditAttribution: kenorb commentedComment #18
LendudeThis version is not supported anymore.