You are here

protected function RateMultilingualTest::setUp in Rate 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/RateMultilingualTest.php, line 46

Class

RateMultilingualTest
Tests voting for multilingual content.

Namespace

Drupal\Tests\rate\Functional

Code

protected function setUp() {
  parent::setUp();

  // Add additional language.
  ConfigurableLanguage::createFromLangcode('pl')
    ->save();
  NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ])
    ->save();

  // Enable voting on article.
  $this
    ->config('rate.settings')
    ->set('enabled_types_widgets.node', [
    'article' => [
      'widget_type' => 'fivestar',
    ],
  ])
    ->set('use_ajax', FALSE)
    ->save();

  // Creates a translated node.
  $this->node = Node::create([
    'title' => 'English article',
    'type' => 'article',
  ]);
  $this->node
    ->addTranslation('pl', [
    'title' => 'Polish article',
  ]);
  $this->node
    ->save();
  $user = $this
    ->createUser([
    'access content',
    'cast rate vote on node of article',
  ]);
  $this
    ->drupalLogin($user);
}