In EntityTranslationTestCase there is a drupal_static_reset('locale_url_outbound_alter');, this means in any subsequent drupalGet()/drupalPost() calls to the sandbox, locale_language_url_rewrite_url() will prepend to the requested URL the prefix from the host system (ie. $language_url->prefix).

This as the $language_url global has not been reset and still contains the language object from the URL on the host system, instead of that of the sandbox.

Examples:

  • Tests are run from en/admin/config/development/testing and configured prefix for english is 'en' on the host system => drupalGet('node/add/page') does a call to en/node/add/page => unexpected 404 ensues as english doesn't have a prefix on the sandbox system.
  • Tests are run from nl/admin/config/development/testing, configured prefix for Dutch is 'nl' on the host system => drupalGet('node/add/page') does a call to nl/node/add/page => unexpected 404 ensues as there is no language with a nl prefix enabled on the sandbox system.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stefan.r’s picture

Issue summary: View changes
stefan.r’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
425 bytes

Reloading the $language_url global with a drupal_language_initialize() fixes things :)

stefan.r’s picture

Issue summary: View changes
stefan.r’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: entity_translation-2284727-brokentest-1.patch, failed testing.

stefan.r’s picture

Status: Needs work » Needs review
FileSize
517 bytes

Status: Needs review » Needs work

The last submitted patch, 6: entity_translation-2284727-brokentest-6.patch, failed testing.

stefan.r’s picture

Status: Needs work » Needs review
FileSize
426 bytes
stefan.r’s picture

Title: Tests broken when run from URL with prefix that does not exist in sandbox » Tests broken when run from URL with prefix that does not exist in sandbox (l10n_client)

.

stefan.r’s picture

Title: Tests broken when run from URL with prefix that does not exist in sandbox (l10n_client) » Tests broken when run from URL with prefix that does not exist in sandbox

Had accidently edited this issue instead of posting a new one...

Stevel’s picture

I believe this problem occurs in more modules than just Entity Translation. I submitted a patch for drupal core to fix this in a more general way: #2724773: Translation tests fail on site with english language prefix (global $language_url is not reset in tests).

Stevel’s picture

Status: Needs review » Fixed

This should be working properly now, since $language_url is now reset during testing.

plach’s picture

Thanks!

Status: Fixed » Closed (fixed)

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