public function NodeThumbsUpWidgetTest::testVoting in Rate 8
Same name in this branch
- 8 tests/src/Functional/NodeThumbsUpWidgetTest.php \Drupal\Tests\rate\Functional\NodeThumbsUpWidgetTest::testVoting()
- 8 tests/src/FunctionalJavascript/NodeThumbsUpWidgetTest.php \Drupal\Tests\rate\FunctionalJavascript\NodeThumbsUpWidgetTest::testVoting()
Tests voting.
File
- tests/
src/ Functional/ NodeThumbsUpWidgetTest.php, line 25
Class
- NodeThumbsUpWidgetTest
- Tests for the "Thumbs Up" widget.
Namespace
Drupal\Tests\rate\FunctionalCode
public function testVoting() {
$session = $this
->assertSession();
// Log in as first user.
$this
->drupalLogin($this->users[0]);
$this
->drupalGet('node/1');
$this
->assertThumbsUp(0);
$session
->linkNotExists('Undo');
// Vote 'Up'.
$this
->clickLink('Up');
$this
->assertThumbsUp(1);
$session
->linkExists('Undo');
// Unvote 'Up'.
$this
->clickLink('Undo');
$this
->assertThumbsUp(0);
$session
->linkNotExists('Undo');
// Vote 'Up'.
$this
->clickLink('Up');
$this
->assertThumbsUp(1);
$session
->linkExists('Undo');
// Log in as different user.
$this
->drupalLogin($this->users[1]);
$this
->drupalGet('node/1');
$this
->assertThumbsUp(1);
$session
->linkNotExists('Undo');
// Vote 'Up'.
$this
->clickLink('Up');
$this
->assertThumbsUp(2);
$session
->linkExists('Undo');
}