PollBlockTest.php in Poll 8
File
tests/src/Functional/PollBlockTest.php
View source
<?php
namespace Drupal\Tests\poll\Functional;
class PollBlockTest extends PollTestBase {
public static $modules = array(
'block',
);
function setUp() {
parent::setUp();
$this
->drupalPlaceBlock('poll_recent_block');
}
function testRecentBlock() {
$poll = $this->poll;
$user = $this->web_user;
$this
->drupalLogin($user);
$this
->drupalGet('user');
$this
->assertText($poll
->label());
$options = $poll
->getOptions();
foreach ($options as $option) {
$this
->assertText($option);
}
$edit = array(
'choice' => '1',
);
$this
->drupalPostForm('user/' . $this->web_user
->id(), $edit, t('Vote'));
$this
->assertText('Your vote has been recorded.');
$this
->assertText('Total votes: 1');
$poll
->close();
$poll
->save();
$this
->drupalGet('user/' . $user
->id());
$this
->assertNoText($poll
->label());
}
}