Commit 086fcd07 authored by webchick's avatar webchick
Browse files

Issue #1214876 by brianV, Shyamala: Fixed Removing a poll choice doesn't actually work.

parent 6f10a4ed
......@@ -594,6 +594,10 @@ function poll_update($node) {
->condition('nid', $node->nid)
->condition('chid', $key)
->condition('nid', $node->nid)
->condition('chid', $choice['chid'])
......@@ -746,3 +746,39 @@ class PollExpirationTestCase extends PollTestCase {
$this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Poll has expired.'));
class PollDeleteChoiceTestCase extends PollTestCase {
public static function getInfo() {
return array(
'name' => 'Poll choice deletion',
'description' => 'Test the poll choice deletion logic.',
'group' => 'Poll',
function setUp() {
function testChoiceRemoval() {
// Set up a poll with three choices.
$title = $this->randomName();
$choices = array('First choice', 'Second choice', 'Third choice');
$poll_nid = $this->pollCreate($title, $choices, FALSE);
$this->assertTrue($poll_nid, t('Poll for choice deletion logic test created.'));
// Edit the poll, and try to delete first poll choice.
$edit['choice[chid:1][chtext]'] = '';
$this->drupalPost(NULL, $edit, t('Save'));
// Click on the poll title to go to node page.
// Check the first poll choice is deleted, while the others remain.
$this->assertNoText('First choice', t('First choice removed.'));
$this->assertText('Second choice', t('Second choice remains.'));
$this->assertText('Third choice', t('Third choice remains.'));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment