You are here

protected function ViewsFivestarWidgetTest::setUp in Rate 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/ViewsFivestarWidgetTest.php, line 60

Class

ViewsFivestarWidgetTest
Tests Views Fivestar Widget.

Namespace

Drupal\Tests\rate\FunctionalJavascript

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  ViewTestData::createTestViews(get_class($this), [
    'rate_views_test',
  ]);
  NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ])
    ->save();

  // Enable 'Fivestar' on Article.
  $this
    ->config('rate.settings')
    ->set('enabled_types_widgets.node', [
    'article' => [
      'widget_type' => 'fivestar',
    ],
  ])
    ->set('use_ajax', TRUE)
    ->save();
  $this
    ->drupalCreateNode([
    'type' => 'article',
    'nid' => 1,
  ])
    ->save();
  $this
    ->drupalCreateNode([
    'type' => 'article',
    'nid' => 2,
  ])
    ->save();
  $permissions = [
    'access content',
    'cast rate vote on node of article',
  ];
  $this->users[0] = $this
    ->createUser($permissions);
  $this->users[1] = $this
    ->createUser($permissions);
}