? .buildpath
? .cache
? .project
? .settings
? PhpProject1
? files
? modules/simpletest/simpletest.moduleOLD
? sites/all/modulesNOTNEEDED
? sites/default/files
? sites/default/settings.php
Index: modules/poll/poll.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.test,v
retrieving revision 1.5
diff -u -r1.5 poll.test
--- modules/poll/poll.test	5 Aug 2008 18:07:14 -0000	1.5
+++ modules/poll/poll.test	28 Aug 2008 08:44:21 -0000
@@ -131,3 +131,52 @@
   }
 }
 
+class PollMostRecentBlockTestCase extends PollTestCase {
+  function getInfo() {
+    return array('name' => t('Most recent poll block test'), 'description' => t('Test the most recent poll block'), 'group' => t('Poll'));
+  }
+  
+  function setUp() {
+    parent::setUp('poll');
+    
+    // Create and login user
+    $admin_user = $this->drupalCreateUser(array('administer blocks', 'create poll content'));
+    $this->drupalLogin($admin_user);
+  }
+  
+  /**
+   * Test the most recent poll black
+   *  - test if polls exist/poll block is visible
+   *  - create a test poll
+   *  - check if the poll is the most recent
+   *  
+   *  @access public
+   */
+  public function testMostRecentPollBlock() {
+    // Set the block to the disabled region.
+    $edit = array();
+    $edit['poll_recent[region]'] = 'right';
+    $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
+    
+    $this->assertNoRaw('id="block-poll-recent"', t('Poll block is not visible without content.'));
+    
+    // Create a sample poll to be used in the test
+    $title = $this->randomName();
+    $choices = $this->_generateChoices(5);
+    $this->pollCreate($title, $choices, TRUE);
+    
+    $this->assertRaw('id="block-poll-recent"', t('Poll block is visible.'));
+    
+    // A page where only the right-most poll block is displayed is required.
+    $this->drupalGet('user');
+    $this->assertText($title, t('The correct poll is visible.'));
+    
+    $secondTitle = $this->randomName();
+    $secondChoices = $this->_generateChoices(6);
+    $this->pollCreate($secondTitle, $secondChoices);
+    
+    // A page where only the right-most poll block is displayed is required.
+    $this->drupalGet('user');
+    $this->assertText($secondTitle, t('The most recent poll is shown.'));
+  }
+}