This information is from the code coverage report (see http://coverage.cwgordon.com/coverage).

We need to test:

1) Attempting to have no category name for a site-wide contact form category.
2) Attempting to have no recipients for a site-wide contact form category.
3) Updating a site-wide contact form category.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

harrisben’s picture

1) Navigating to /contact or via the contact menu item (after enabling it) without setting up a category presents an error message "The contact form has not been configured. Add one or more categories to the form", which correctly provides a link directly to the settings page to add a contact form category.

2) When adding a contact form category the form correctly requires a valid email-formatted recipient.

Not sure if it's intended, but the contact form settings page doesn't have the same drag-and-drop prioritising that modules such as blocks and taxonomy have. It would be good to have it for consistency.

cwgordon7’s picture

I mean automated tests. Not manual ones.

harrisben’s picture

oh, then please disregard my other posts...

catch’s picture

Status: Active » Needs review
FileSize
2.49 KB

#1 and #2 are dead code - both those fields are '#required' => TRUE which means they never get to validation, so that can never be run.

So this patch adds a test to ensure the requirement is set (so covers the behaviour for #1 and #2), and removes the redundant validation code for empty fields. That'll mean it gets caught if someone tries to removed the '#required' => TRUE later on. Doesn't touch #3 at all.

contact.test has four known failures #253506 which are unaffected by this patch.

Nice side effect of the code coverage reports :)

dmitrig01’s picture

Status: Needs review » Needs work
+    $this->addCategory($category = '', '', '', TRUE);

I'm not so sure this is gonna work

catch’s picture

Status: Needs work » Needs review

dmitrig01, it's not supposed to. Or did you mean something else?

Dries’s picture

Status: Needs review » Fixed

I think this patch looks good. Committed to CVS HEAD.

catch’s picture

Title: Tests needed: contact.admin.inc » Tests needed: contact - updating site wide category
Status: Fixed » Active

Thanks.

We're still missing #3, so markin back to active for that one.

andreiashu’s picture

Category: bug » task
Priority: Critical » Normal
Status: Active » Needs work
FileSize
2.44 KB

This is my first patch.
Is it enough to test for the text "Category %category has been added." or should i take every filed and test if it has been updated ?

cwgordon7’s picture

This needs to comply to coding standards, first of all. Please see http://drupal.org/coding-standards.

I'd also add a check for the category updates in the database.

andreiashu’s picture

FileSize
2.91 KB

cwgordon7, thanks for suggestion. I think now the coding standards should be fine. I also added db category updates check.
Have a look.

cwgordon7’s picture

Status: Needs work » Reviewed & tested by the community

Looks great. Tests all pass. RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Back from vacation -- see http://buytaert.net/houffalize. Committed to CVS HEAD. Will be working the patch queue the next couple of days.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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