public function FivestarTestCase::testViewerRatingAjax in Fivestar 8
Same name and namespace in other branches
- 7.2 test/fivestar.field.test \FivestarTestCase::testViewerRatingAjax()
Test that users can rate content with exposed widgets.
File
- test/
fivestar.field.test, line 74 - Simpletests for the Fivestar module.
Class
Code
public function testViewerRatingAjax() {
// Add a viewer-rated fivestar field to the test_node_type content type.
$this
->createFivestarField([
'widget_type' => 'exposed',
]);
// Add an test_node_type to rate.
$node = $this
->drupalCreateNode([
'type' => 'test_node_type',
]);
// Rate the test_node_type.
$this
->drupalLogin($this->voter_user);
$edit = [
'vote' => '60',
];
$commands = $this
->drupalPostAJAX('node/' . $node->nid, $edit, "vote", NULL, [], [], "fivestar-custom-widget");
$expected = [
'command' => 'fivestarUpdate',
];
$this
->assertCommand($commands, $expected, "The fivestarUpdate AJAX command was returned.");
}