You are here

protected function ColorbuttonTest::setUp in CKEditor Color Button 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/ColorbuttonTest.php, line 36

Class

ColorbuttonTest
Colorbutton tests.

Namespace

Drupal\Tests\colorbutton\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  NodeType::create([
    'type' => 'article',
    'name' => 'Article',
  ])
    ->save();
  FieldConfig::create([
    'field_name' => 'body',
    'entity_type' => 'node',
    'bundle' => 'article',
    'format' => 'full_html',
  ])
    ->save();

  /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
  $display_repository = \Drupal::service('entity_display.repository');
  $display_repository
    ->getViewDisplay('node', 'article')
    ->setComponent('body')
    ->save();
  $display_repository
    ->getFormDisplay('node', 'article')
    ->setComponent('body')
    ->save();
  $this
    ->drupalCreateNode([
    'type' => 'article',
    'title' => 'Article colorbutton',
    'nid' => 1,
    'body' => [
      [
        'value' => $this
          ->randomMachineName(32),
        'format' => 'full_html',
      ],
    ],
  ])
    ->save();
  $permissions = [
    'bypass node access',
    'administer site configuration',
    'use text format full_html',
    'administer filters',
  ];
  $user = $this
    ->createUser($permissions);
  $this
    ->drupalLogin($user);
}