From f2cbf55033d0ed891df839d412547d6b28aeb35e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 26 Apr 2009 16:31:23 +0000 Subject: - Patch #440894 by brianV: code style and documentation clean-up. --- modules/poll/poll.install | 5 +++++ modules/poll/poll.module | 8 ++++---- modules/poll/poll.test | 19 ++++++++++++------- 3 files changed, 21 insertions(+), 11 deletions(-) (limited to 'modules') 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 @@ -1,6 +1,11 @@ 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 @@ 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"); -- cgit v1.2.3