1. Enable locale and testing module
2. Add a second language
3. Try to to run any tests

You'll get fatal errors about simpletest24353_languages doesn't exist. This is because drupal_multilingual in boostrap.inc doesn't get reset when tests start since it doesn't use drupal_static.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
652 bytes

Patch attached that fixes running tests when the host system has more than one language enabled.

rfay’s picture

Status: Needs review » Reviewed & tested by the community

This looks obvious to me and a no-brainer.

Read the patch. Looks good.
I tested and got the failure.
Applied the patch and fixed the failure.

IMO, it's good to go. It passes the bot. It's so simple and it's also best practice, so I'm setting to RTBC. If anybody disagrees or you think more opinions are needed, then reset it.

plach’s picture

IMO we can simply drop the static caching: having a function call to cache another function call, both of which are more or less equal in terms of cpu usage, makes no sense.

I had this need also in #632172-6: Node language and field languages may differ and following.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Yes, agreed with #3, drupal_static() may even be slower than variable_get().

plach’s picture

Component: base system » language system
Status: Needs work » Needs review
FileSize
688 bytes

This one implements #3.

plach’s picture

Sorry, didn't notice the issue was assigned to Dave Reid.

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community

Good enough for me. Either one works.

plach’s picture

Title: drupal_multilingual() needs static resets for testing » Static caching in drupal_multilingual() breaks tests

Changing the issue title accordingly.

plach’s picture

Issue tags: +Quick fix

tagging

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Nice! This bug has long haunted the testing framework. Glad to see it put to rest. I'd mark it "Needs tests" but I don't think we have a reliable way of testing the testing system. ;P

Committed to HEAD!

Dave Reid’s picture

@webchick @platch Yippee! Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix

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