You are here

protected function NodeVoteTrait::voteFivestarById in Rate 8

Same name and namespace in other branches
  1. 8.2 tests/src/Traits/NodeVoteTrait.php \Drupal\Tests\rate\Traits\NodeVoteTrait::voteFivestarById()

Vote "Fivestar" by node id.

Parameters

int $nid: The node id.

int $stars: The number of stars vote (from 1 to 5).

1 call to NodeVoteTrait::voteFivestarById()
ViewsFivestarWidgetTest::testFivestarViewsWidget in tests/src/FunctionalJavascript/ViewsFivestarWidgetTest.php
Tests a fivestar views widget.

File

tests/src/Traits/NodeVoteTrait.php, line 21

Class

NodeVoteTrait
Provides methods to voting on nodes.

Namespace

Drupal\Tests\rate\Traits

Code

protected function voteFivestarById($nid, $stars) {
  $this
    ->assertSession()
    ->elementExists('css', '.rate-fivestar-1');
  $node_selector = '[data-drupal-selector="rate-node-' . $nid . '"]';
  $this
    ->click($node_selector . ' .rate-fivestar-' . $stars);
}