You are here

protected function RateJavascriptNodeWidgetTestBase::setUp in Rate 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/RateJavascriptNodeWidgetTestBase.php, line 55

Class

RateJavascriptNodeWidgetTestBase
Base class for Rate Javascript functional tests.

Namespace

Drupal\Tests\rate\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ])
    ->save();

  // Enable voting on article.
  $this
    ->config('rate.settings')
    ->set('enabled_types_widgets.node', [
    'article' => [
      'widget_type' => $this->widget,
    ],
  ])
    ->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);
  $this->users[2] = $this
    ->createUser($permissions);
}