You are here

protected function CKEditorStylesComboAdminTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php \Drupal\Tests\ckeditor\Functional\CKEditorStylesComboAdminTest::setUp()
  2. 9 core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php \Drupal\Tests\ckeditor\Functional\CKEditorStylesComboAdminTest::setUp()

File

core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php, line 52

Class

CKEditorStylesComboAdminTest
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');
  $this->defaultSettings = $ckeditor
    ->getDefaultSettings();
  $this->defaultSettings['toolbar']['rows'][0][] = [
    'name' => 'Styles dropdown',
    'items' => [
      'Styles',
    ],
  ];
  $editor = Editor::create([
    'format' => $this->format,
    'editor' => 'ckeditor',
    'settings' => $this->defaultSettings,
  ]);
  $editor
    ->save();
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer filters',
  ]);
}