protected function NodeRateWidgetFivestarTest::setUp in Rate 8.2
Overrides NodeRateWidgetTestBase::setUp
File
- tests/
src/ FunctionalJavascript/ NodeRateWidgetFivestarTest.php, line 17
Class
- NodeRateWidgetFivestarTest
- Tests for the "Fivestar" widget.
Namespace
Drupal\Tests\rate\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
// Create the rate widget.
$options = [
[
'value' => 1,
'label' => 'Star 1',
],
[
'value' => 2,
'label' => 'Star 2',
],
[
'value' => 3,
'label' => 'Star 3',
],
[
'value' => 4,
'label' => 'Star 4',
],
[
'value' => 5,
'label' => 'Star 5',
],
];
$this
->createRateWidget('fivestar', 'Fivestar', 'fivestar', $options, [
'node.article',
]);
// Reset any static cache.
drupal_static_reset();
// Verify the new widget has been added correctly.
$rate_widget = RateWidget::load('fivestar');
$this
->assertEqual($rate_widget
->getLabel(), 'Fivestar');
$permissions = [
'access content',
'cast rate vote on node of article',
];
$this->users[1] = $this
->createUser($permissions);
$this->users[2] = $this
->createUser($permissions);
$this->users[3] = $this
->createUser($permissions);
}