I was working on test that was using drupalPost on admin/settings/site-information, and for the longest time I couldn't figure out why it wasn't saving. I finally narrowed it down to the fact that the site_mail field was empty (which is a required field). I would think that the required variable site_mail should be set to 'simpletest@example.com' in DrupalWebTestCase::setUp(), since that's a valid, easy-to-remember e-mail address already used in contact.test.

CommentFileSizeAuthor
#1 343765-simpletest-site-mail-D7.patch847 bytesDave Reid
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Patch provided for review.

Dave Reid’s picture

Status: Active » Needs review

Bah, forgot to set as code needs review. I suck.

Dave Reid’s picture

A side note on this, the default value for site_mail is ini_get('sendmail_from'), which is empty on my default Ubuntu 8.04-PHP install.

Anonymous’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

looks good to me. bumping this to critical, as it will break (at least) anything that tries to test admin/settings/site-information.

Damien Tournoud’s picture

Priority: Critical » Normal
Status: Reviewed & tested by the community » Closed (won't fix)

If you need it, simply set it in the setUp() method of your test. That's clearly not a bug in Simpletest, as we don't have that approach for any other variable.

Dave Reid’s picture

Hmm...I just think it's wrong that SimpleTest is running all these tests without a valid site_mail variable since my ini_set('sendmail_from') is empty. All the other required site variables have "normal" default strings.

Anonymous’s picture

Status: Closed (won't fix) » Postponed (maintainer needs more info)

@Damien: not sure i agree with this. i would have thought the organising idea for a test environment would be that it would match a default drupal install + some test modules.

maybe you could explain why its ok to have a test drupal install that doesn't set site_mail?

chx’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

Meh, a variable_set cant hurt and it is quite rational to presume that parts of Drupal will except site_mail to be set. (it's high time we provide a write-mails-to-files lib as part of simpletest. followup issue)

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I agree that this seems sensible to me. Special-casing this in every test that needs it (or the form it's set in) seems like an exercise in frustration. In theory, the installer should not be letting us continue without that value set though. Hm.

Anyway, committed to HEAD.

Status: Fixed » Closed (fixed)

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