You are here

protected function RateNodeWidgetTestBase::setUp in Rate 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/RateNodeWidgetTestBase.php, line 55

Class

RateNodeWidgetTestBase
Base class for Rate functional tests.

Namespace

Drupal\Tests\rate\Functional

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', FALSE)
    ->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);
}