You are here

public function AssertRateWidgetTrait::assertThumbsUpDown in Rate 8

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

Assert "Thumbs Up / Down".

Parameters

int $expected_up: The expected result of voting for 'Up'. Result in percent (e.g. 67).

int $expected_down: The expected result of voting for 'Down'. Result in percent (e.g. 33).

4 calls to AssertRateWidgetTrait::assertThumbsUpDown()
NodeMultipleWidgetTest::testVoting in tests/src/Functional/NodeMultipleWidgetTest.php
Tests voting.
NodeMultipleWidgetTest::testVoting in tests/src/FunctionalJavascript/NodeMultipleWidgetTest.php
Tests voting.
NodeThumbsUpDownWidgetTest::testVoting in tests/src/Functional/NodeThumbsUpDownWidgetTest.php
Tests voting.
NodeThumbsUpDownWidgetTest::testVoting in tests/src/FunctionalJavascript/NodeThumbsUpDownWidgetTest.php
Tests voting.

File

tests/src/Traits/AssertRateWidgetTrait.php, line 72

Class

AssertRateWidgetTrait
Assert methods to verify results of voting for a single node.

Namespace

Drupal\Tests\rate\Traits

Code

public function assertThumbsUpDown($expected_up, $expected_down) {
  $session = $this
    ->assertSession();
  $session
    ->elementExists('css', '.rate-widget-thumbs-up-down');
  $session
    ->elementTextContains('css', '.thumb-up', $expected_up . '%');
  $session
    ->elementTextContains('css', '.thumb-down', $expected_down . '%');
}