NodeFivestarWidgetTest.php in Rate 8
File
tests/src/Functional/NodeFivestarWidgetTest.php
View source
<?php
namespace Drupal\Tests\rate\Functional;
use Drupal\Tests\rate\Traits\NodeVoteTrait;
class NodeFivestarWidgetTest extends RateNodeWidgetTestBase {
use NodeVoteTrait;
protected $widget = 'fivestar';
protected $labels = [
'Star',
];
public function testVoting() {
$session = $this
->assertSession();
$this
->drupalLogin($this->users[0]);
$this
->drupalGet('node/1');
$this
->assertFivestar(0);
$session
->linkExists('Star');
$session
->linkNotExists('Undo');
$this
->voteFivestar(5);
$this
->assertFivestar(5);
$session
->linkExists('Undo');
$this
->drupalLogin($this->users[1]);
$this
->drupalGet('node/1');
$this
->assertFivestar(5);
$session
->linkNotExists('Undo');
$this
->voteFivestar(3);
$this
->assertFivestar(4);
$session
->linkExists('Undo');
$this
->clickLink('Undo');
$this
->assertFivestar(5);
$session
->linkNotExists('Undo');
}
}