function AddedStylesheetsTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/ckeditor5/tests/src/Functional/AddedStylesheetsTest.php, line 52

Class

AddedStylesheetsTest
Test the ckeditor5-stylesheets theme config property.

Namespace

Drupal\Tests\ckeditor5\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $filtered_html_format = FilterFormat::create([
        'format' => 'llama',
        'name' => 'Llama',
        'filters' => [],
        'roles' => [
            RoleInterface::AUTHENTICATED_ID,
        ],
    ]);
    $filtered_html_format->save();
    $this->editor = Editor::create([
        'format' => 'llama',
        'editor' => 'ckeditor5',
        'image_upload' => [
            'status' => FALSE,
        ],
        'settings' => [
            'toolbar' => [
                'items' => [],
            ],
        ],
    ]);
    $this->editor
        ->save();
    $this->assertSame([], array_map(function (ConstraintViolation $v) {
        return (string) $v->getMessage();
    }, iterator_to_array(CKEditor5::validatePair($this->editor, $filtered_html_format))));
    // Create node type.
    $this->drupalCreateContentType([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $this->adminUser = $this->drupalCreateUser([
        'create article content',
        'use text format llama',
        'administer themes',
        'view the administration theme',
        'administer filters',
    ]);
    $this->drupalLogin($this->adminUser);
}

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