You are here

protected function ConditionalFieldLanguageSelectTest::setUp in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/ConditionalFieldLanguageSelectTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldLanguageSelectTest::setUp()

Overrides ConditionalFieldTestBase::setUp

File

tests/src/FunctionalJavascript/ConditionalFieldLanguageSelectTest.php, line 71

Class

ConditionalFieldLanguageSelectTest
Test Conditional Fields Language Select Plugin.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $this->fieldSelector = "[name=\"{$this->fieldName}[0][value]\"]";

  // Get the default language which will trigger the dependency.
  $this->defaultLanguage = \Drupal::languageManager()
    ->getCurrentLanguage()
    ->getId();

  // Enable language selector on node creation page.
  ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
    ->setLanguageAlterable(TRUE)
    ->setDefaultLangcode($this->defaultLanguage)
    ->save();
}