PollResultsTest.php in Poll 8
File
tests/src/Kernel/PollResultsTest.php
View source
<?php
namespace Drupal\Tests\poll\Kernel;
use Drupal\poll\Form\PollViewForm;
class PollResultsTest extends PollKernelTestBase {
public function testPollResults() {
$poll = $this
->createPoll();
$this
->saveVote($poll, $poll
->get('choice')->target_id);
$poll_view_form = new PollViewForm();
$poll_results = $poll_view_form
->showPollResults($poll);
$vote_storage = \Drupal::service('poll_vote.storage');
$user_vote = $vote_storage
->getUserVote($poll);
$this
->assertEquals($user_vote['chid'], $poll_results['#vote']);
}
}