function PollBlockTestCase::testRecentBlock
Archivo
- drupal-7.x/modules/poll/poll.test, line 383
- Tests for poll.module.
Class
- PollBlockTestCase
Código
function testRecentBlock() {
$this->drupalPost('admin/structure/block/manage/poll/recent/configure', array('title' => $this->randomName(8)), t('Save block'));
$this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
$edit = array();
$edit['blocks[poll_recent][region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
$title = $this->randomName();
$choices = $this->_generateChoices(7);
$poll_nid = $this->pollCreate($title, $choices, TRUE);
$this->drupalGet('user');
$this->assertText($title, 'Poll appears in block.');
$this->drupalLogout();
$vote_user = $this->drupalCreateUser(array('cancel own vote', 'inspect all votes', 'vote on polls', 'access content'));
$this->drupalLogin($vote_user);
$edit = array(
'choice' => '1',
);
$this->drupalPost('user/' . $vote_user->uid, $edit, t('Vote'));
$this->assertText('Your vote was recorded.', 'Your vote was recorded.');
$this->assertText('Total votes: 1', 'Vote count updated correctly.');
$this->assertText('Older polls', 'Link to older polls appears.');
$this->clickLink('Older polls');
$this->assertText('1 vote - open', 'Link to poll listing correct.');
$content_user = $this->drupalCreateUser(array('create poll content', 'edit any poll content', 'access content'));
$this->drupalLogout();
$this->drupalLogin($content_user);
$close_edit = array('active' => 0);
$this->pollUpdate($poll_nid, $title, $close_edit);
$this->drupalGet('user/' . $content_user->uid);
$this->assertNoText($title, 'Poll no longer appears in block.');
}