summaryrefslogtreecommitdiff
path: root/modules/poll/poll.test
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-01-11 23:26:00 -0500
committerwebchick <webchick@24967.no-reply.drupal.org>2012-01-11 23:26:00 -0500
commit371991597778094590ef37a87f4b57a65225797e (patch)
treeaef563f968a3ae2892e8cabea6ee0dc6b9c04b87 /modules/poll/poll.test
parent6f58aa16f0066d59c9e16a855ab1886d72f8d472 (diff)
downloadbrdo-371991597778094590ef37a87f4b57a65225797e.tar.gz
brdo-371991597778094590ef37a87f4b57a65225797e.tar.bz2
Issue #939880 by amateescu, marcingy: Fixed Poll Module throws PDOException when creating poll content.
Diffstat (limited to 'modules/poll/poll.test')
-rw-r--r--modules/poll/poll.test15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index f6f82dfd6..f34964c3f 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -24,8 +24,9 @@ class PollTestCase extends DrupalWebTestCase {
function pollCreate($title, $choices, $preview = TRUE) {
$this->assertTrue(TRUE, 'Create a poll');
+ $admin_user = $this->drupalCreateUser(array('create poll content', 'administer nodes'));
$web_user = $this->drupalCreateUser(array('create poll content', 'access content', 'edit own poll content'));
- $this->drupalLogin($web_user);
+ $this->drupalLogin($admin_user);
// Get the form first to initialize the state of the internal browser.
$this->drupalGet('node/add/poll');
@@ -33,6 +34,18 @@ class PollTestCase extends DrupalWebTestCase {
// Prepare a form with two choices.
list($edit, $index) = $this->_pollGenerateEdit($title, $choices);
+ // Verify that the vote count element only allows non-negative integers.
+ $edit['choice[new:1][chvotes]'] = -1;
+ $edit['choice[new:0][chvotes]'] = $this->randomString(7);
+ $this->drupalPost(NULL, $edit, t('Save'));
+ $this->assertText(t('Negative values are not allowed.'));
+ $this->assertText(t('Vote count for new choice must be an integer.'));
+
+ // Repeat steps for initializing the state of the internal browser.
+ $this->drupalLogin($web_user);
+ $this->drupalGet('node/add/poll');
+ list($edit, $index) = $this->_pollGenerateEdit($title, $choices);
+
// Re-submit the form until all choices are filled in.
if (count($choices) > 2) {
while ($index < count($choices)) {