NodeRateWidgetFivestarTest.php in Rate 8.2
File
tests/src/FunctionalJavascript/NodeRateWidgetFivestarTest.php
View source
<?php
namespace Drupal\Tests\rate\FunctionalJavascript;
use Drupal\rate\Entity\RateWidget;
class NodeRateWidgetFivestarTest extends NodeRateWidgetTestBase {
protected function setUp() {
parent::setUp();
$options = [
[
'value' => 1,
'label' => 'Star 1',
],
[
'value' => 2,
'label' => 'Star 2',
],
[
'value' => 3,
'label' => 'Star 3',
],
[
'value' => 4,
'label' => 'Star 4',
],
[
'value' => 5,
'label' => 'Star 5',
],
];
$this
->createRateWidget('fivestar', 'Fivestar', 'fivestar', $options, [
'node.article',
]);
drupal_static_reset();
$rate_widget = RateWidget::load('fivestar');
$this
->assertEqual($rate_widget
->getLabel(), 'Fivestar');
$permissions = [
'access content',
'cast rate vote on node of article',
];
$this->users[1] = $this
->createUser($permissions);
$this->users[2] = $this
->createUser($permissions);
$this->users[3] = $this
->createUser($permissions);
}
public function testVoting() {
$this
->drupalLogin($this->users[1]);
$this
->drupalGet('node/1');
$this
->drupalLogin($this->users[2]);
$this
->drupalGet('node/1');
}
}