function CKEditorStylesComboTranslationTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboTranslationTest.php \Drupal\Tests\ckeditor\Functional\CKEditorStylesComboTranslationTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboTranslationTest.php, line 45

Class

CKEditorStylesComboTranslationTest
Tests administration of the CKEditor StylesCombo plugin.

Namespace

Drupal\Tests\ckeditor\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this->format = strtolower($this->randomMachineName());
  $filter_format = FilterFormat::create([
    'format' => $this->format,
    'name' => $this->randomString(),
    'filters' => [],
  ]);
  $filter_format->save();
  $ckeditor = $this->container
    ->get('plugin.manager.editor')
    ->createInstance('ckeditor');
  $settings = $ckeditor->getDefaultSettings();
  $settings['toolbar']['rows'][0][] = [
    'name' => 'Styles dropdown',
    'items' => [
      'Styles',
    ],
  ];
  $editor = Editor::create([
    'format' => $this->format,
    'editor' => 'ckeditor',
    'settings' => $settings,
  ]);
  $editor->save();
  $this->adminUser = $this->drupalCreateUser([
    'administer filters',
    'translate configuration',
  ]);
  ConfigurableLanguage::createFromLangcode('de')->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.