summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/poll/poll.install5
-rw-r--r--modules/poll/poll.module8
-rw-r--r--modules/poll/poll.test19
3 files changed, 21 insertions, 11 deletions
diff --git a/modules/poll/poll.install b/modules/poll/poll.install
index 04b7ad5a5..c64683e98 100644
--- a/modules/poll/poll.install
+++ b/modules/poll/poll.install
@@ -2,6 +2,11 @@
// $Id$
/**
+ * @file
+ * Install file for poll module.
+ */
+
+/**
* Implementation of hook_install().
*/
function poll_install() {
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 64b1f044d..5f55ba53a 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -249,7 +249,7 @@ function poll_form(&$node, $form_state) {
$delta = count($node->choice);
$weight = -$delta;
foreach ($node->choice as $chid => $choice) {
- $key = 'chid:'. $chid;
+ $key = 'chid:' . $chid;
$form['choice_wrapper']['choice'][$key] = _poll_choice_form($key, $choice['chid'], $choice['chtext'], $choice['chvotes'], $choice['weight'], $choice_count);
$weight = ($choice['weight'] > $weight) ? $choice['weight'] : $weight;
}
@@ -258,7 +258,7 @@ function poll_form(&$node, $form_state) {
// Add initial or additional choices.
$existing_delta = $delta;
for ($delta; $delta < $choice_count; $delta++) {
- $key = 'new:'. ($delta - $existing_delta);
+ $key = 'new:' . ($delta - $existing_delta);
$form['choice_wrapper']['choice'][$key] = _poll_choice_form($key, NULL, '', 0, $weight, $choice_count);
}
@@ -537,7 +537,7 @@ function poll_delete($node) {
->execute();
db_delete('poll_vote')
->condition('nid', $node->nid)
- ->execute();
+ ->execute();
}
/**
@@ -751,7 +751,7 @@ function theme_poll_choices($form) {
);
// Add any additional classes set on the row.
- $row['class'] .= isset($form[$key]['#attributes']['class']) ? ' '. $form[$key]['#attributes']['class'] : '';
+ $row['class'] .= isset($form[$key]['#attributes']['class']) ? ' ' . $form[$key]['#attributes']['class'] : '';
$rows[] = $row;
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 6ff2a7825..a9bdea6cc 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -1,6 +1,11 @@
<?php
// $Id$
+/**
+ * @file
+ * Tests for the poll module.
+ */
+
class PollTestCase extends DrupalWebTestCase {
/**
@@ -25,7 +30,7 @@ class PollTestCase extends DrupalWebTestCase {
if (count($choices) > 2) {
// Re-submit the form while the choices are all in
- while($index < count($choices)) {
+ while ($index < count($choices)) {
$this->drupalPost(NULL, $edit, t('More choices'));
list($edit, $index) = $this->_pollGenerateEdit($title, $choices, $index);
}
@@ -33,7 +38,7 @@ class PollTestCase extends DrupalWebTestCase {
if ($test_preview) {
$this->drupalPost(NULL, $edit, t('Preview'));
- foreach($choices as $k => $choice_text) {
+ foreach ($choices as $k => $choice_text) {
$this->assertRaw($choice_text, t('Choice @choice found was in preview.', array('@choice' => $k)));
}
list($edit, $index) = $this->_pollGenerateEdit($title, $choices, $index);
@@ -55,10 +60,10 @@ class PollTestCase extends DrupalWebTestCase {
$edit = array(
'title' => $title
);
- foreach($already_submitted_choices as $k => $text) {
+ foreach ($already_submitted_choices as $k => $text) {
$edit['choice[chid:' . $k . '][chtext]'] = $text;
}
- foreach($new_choices as $k => $text) {
+ foreach ($new_choices as $k => $text) {
$edit['choice[new:' . $k . '][chtext]'] = $text;
}
return array($edit, count($already_submitted_choices) + count($new_choices));
@@ -66,7 +71,7 @@ class PollTestCase extends DrupalWebTestCase {
function _generateChoices($count = 7) {
$choices = array();
- for($i = 1; $i <= $count; $i++) {
+ for ($i = 1; $i <= $count; $i++) {
$choices[] = $this->randomName();
}
return $choices;
@@ -112,10 +117,10 @@ class PollVoteTestCase extends PollTestCase {
$this->drupalLogin($web_user);
// Record a vote for the first choice.
- $edit = array (
+ $edit = array(
'choice' => '1',
);
- $this->drupalPost('node/'. $poll_nid, $edit, t('Vote'));
+ $this->drupalPost('node/' . $poll_nid, $edit, t('Vote'));
$this->assertText('Your vote was recorded.', 'Your vote was recorded.');
$this->drupalGet("node/$poll_nid/votes");