We need to test the poll module's form validation.

Suggested assertions:
- Cannot set an option to have a negative amount of votes.
- Cannot have less than two voting options.

Comments

chrisshattuck’s picture

Component: tests » poll.module
StatusFileSize
new1.75 KB

Patch for two tests above.

cwgordon7’s picture

Status: Active » Needs work
chrisshattuck’s picture

Ah, thanks cwgordon7. stompeers = patch noob.

chrisshattuck’s picture

Also, what needs work? Any feedback?

cwgordon7’s picture

Sorry, I meant to mention what needed work with the patch. There is trailing whitespace on several lines, and also, it would be preferable if you could use more descriptive messages in your assertions. For example, the second parameter of assertText should not just be the text you were searching for repeated, but something like t('Cannot submit poll with less than two voting options.'), etc.

chrisshattuck’s picture

Status: Needs work » Needs review
StatusFileSize
new1.77 KB

Here is the re-rolled patch, with updated verbiage and white space removed.

dawehner’s picture

the patch looks fine.

  1. but i'm wondering about
    +    $web_user = $this->drupalCreateUser(array('create poll content', 'access content', 'administer nodes'));
    

    Shouldn't the user be named $admin_user?

  2. All Functions should have /** */ Comments
  3. All Comments should have a . at the end of the sentence
dawehner’s picture

Status: Needs review » Needs work

so code needs work

catch’s picture

Category: bug » task
Priority: Critical » Normal

Moving this out of the critical bugs queue - see #607038: Meta issue: fix gaps in code coverage.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.82 KB
+    $web_user = $this->drupalCreateUser(array('create poll content', 'access content', 'administer nodes'));

Why does this user need administer nodes.

Anyway i updated the patch

Status: Needs review » Needs work

The last submitted patch failed testing.

amateescu’s picture

Status: Needs work » Closed (duplicate)

This was fixed in #1295546: Weight and number of votes not getting saved when updating a poll.. Can't find a better status than closed (duplicate)..