You are here

function PollVoteTest::testPollVote in SimpleTest 6

File

tests/poll_module.test, line 77

Class

PollVoteTest

Code

function testPollVote() {
  $this
    ->pollCreate(FALSE);
  $this
    ->drupalGet('logout');
  $web_user = $this
    ->drupalCreateUserRolePerm(array(
    'cancel own vote',
    'inspect all votes',
    'vote on polls',
    'access content',
  ));
  $this
    ->drupalLoginUser($web_user);
  $edit = array(
    'choice' => '1',
  );
  $this
    ->drupalPost('node/' . $this->nid, $edit, 'Vote');
  $this
    ->assertText('Your vote was recorded.', 'Your vote was recorded.');
  $this
    ->drupalGet("node/{$this->nid}/votes");
  $this
    ->assertText(t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.'), 'Vote table text.');
  $this
    ->assertText('choice 2', 'vote recorded');
}