/**
     * Ensure comment form works with history and big_pipe modules.
     *
     * @see https://www.drupal.org/node/2698811
     */
    public function testCommentForm_2698811()
    {
        $this->assertTrue($this->container->get('module_installer')->install(['comment', 'history', 'ckeditor'], TRUE), 'Installed modules.');
        // Ensure an `article` node type exists.
        $this->createContentType(['type' => 'article']);
        $this->addDefaultCommentField('node', 'article');
        // Enable CKEditor.
        $format = $this->randomMachineName();
        FilterFormat::create(['format' => $format, 'name' => $this->randomString(), 'weight' => 1, 'filters' => []])->save();
        $settings['toolbar']['rows'] = [[['name' => 'Links', 'items' => ['DrupalLink', 'DrupalUnlink']]]];
        $editor = Editor::create(['format' => $format, 'editor' => 'ckeditor']);
        $editor->setSettings($settings);
        $editor->save();
        $admin_user = $this->drupalCreateUser(['access comments', 'post comments', 'use text format ' . $format]);
        $this->drupalLogin($admin_user);
        $node = $this->createNode(['type' => 'article', 'comment' => CommentItemInterface::OPEN]);
        // Create some comments.
        foreach (range(1, 5) as $i) {
            $comment = Comment::create(['status' => CommentInterface::PUBLISHED, 'field_name' => 'comment', 'entity_type' => 'node', 'entity_id' => $node->id()]);
            $comment->save();
        }
        $this->drupalGet($node->toUrl()->toString());
        // Confirm that CKEditor loaded.
        $javascript = <<<JS
    (function(){
      return Object.keys(CKEDITOR.instances).length > 0;
    }());
JS;
        $this->assertJsCondition($javascript);
    }
示例#2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     FilterFormat::create(array('format' => 'my_text_format', 'name' => 'My text format', 'filters' => array('filter_autop' => array('module' => 'filter', 'status' => TRUE))))->save();
     FieldStorageConfig::create(array('field_name' => 'formatted_text', 'entity_type' => $this->entityType, 'type' => 'text', 'settings' => array()))->save();
     FieldConfig::create(['entity_type' => $this->entityType, 'bundle' => $this->bundle, 'field_name' => 'formatted_text', 'label' => 'Filtered text'])->save();
 }
 protected function setUp()
 {
     parent::setUp();
     // Use Classy theme for testing markup output.
     \Drupal::service('theme_handler')->install(['classy']);
     \Drupal::service('theme_handler')->setDefault('classy');
     // Grant the 'view test entity' permission.
     $this->installConfig(array('user'));
     Role::load(RoleInterface::ANONYMOUS_ID)->grantPermission('view test entity')->save();
     // The label formatter rendering generates links, so build the router.
     $this->container->get('router.builder')->rebuild();
     $this->createEntityReferenceField($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType, 'default', array(), FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     // Set up a field, so that the entity that'll be referenced bubbles up a
     // cache tag when rendering it entirely.
     FieldStorageConfig::create(array('field_name' => 'body', 'entity_type' => $this->entityType, 'type' => 'text', 'settings' => array()))->save();
     FieldConfig::create(['entity_type' => $this->entityType, 'bundle' => $this->bundle, 'field_name' => 'body', 'label' => 'Body'])->save();
     entity_get_display($this->entityType, $this->bundle, 'default')->setComponent('body', array('type' => 'text_default', 'settings' => array()))->save();
     FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML'))->save();
     // Create the entity to be referenced.
     $this->referencedEntity = $this->container->get('entity_type.manager')->getStorage($this->entityType)->create(array('name' => $this->randomMachineName()));
     $this->referencedEntity->body = array('value' => '<p>Hello, world!</p>', 'format' => 'full_html');
     $this->referencedEntity->save();
     // Create another entity to be referenced but do not save it.
     $this->unsavedReferencedEntity = $this->container->get('entity_type.manager')->getStorage($this->entityType)->create(array('name' => $this->randomMachineName()));
     $this->unsavedReferencedEntity->body = array('value' => '<p>Hello, unsaved world!</p>', 'format' => 'full_html');
 }
示例#4
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->filter = FilterFormat::create(['format' => 'test_format', 'name' => $this->randomMachineName()]);
     $this->filter->setFilterConfig('video_embed_wysiwyg', ['status' => 1]);
     $this->filter->save();
 }
示例#5
0
 protected function setUp()
 {
     parent::setUp();
     // Let there be T-rex.
     \Drupal::state()->set('editor_test_give_me_a_trex_thanks', TRUE);
     \Drupal::service('plugin.manager.editor')->clearCachedDefinitions();
     // Add text formats.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => array()));
     $full_html_format->save();
     // Create article node type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     // Create page node type, but remove the body.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Page'));
     $body = FieldConfig::loadByName('node', 'page', 'body');
     $body->delete();
     // Create a formatted text field, which uses an <input type="text">.
     FieldStorageConfig::create(array('field_name' => 'field_text', 'entity_type' => 'node', 'type' => 'text'))->save();
     FieldConfig::create(array('field_name' => 'field_text', 'entity_type' => 'node', 'label' => 'Textfield', 'bundle' => 'page'))->save();
     entity_get_form_display('node', 'page', 'default')->setComponent('field_text')->save();
     // Create 3 users, each with access to different text formats.
     $this->untrustedUser = $this->drupalCreateUser(array('create article content', 'edit any article content'));
     $this->normalUser = $this->drupalCreateUser(array('create article content', 'edit any article content', 'use text format filtered_html'));
     $this->privilegedUser = $this->drupalCreateUser(array('create article content', 'edit any article content', 'create page content', 'edit any page content', 'use text format filtered_html', 'use text format full_html'));
 }
示例#6
0
 /**
  * Tests CRUD operations for text formats and filters.
  */
 function testTextFormatCrud()
 {
     // Add a text format with minimum data only.
     $format = FilterFormat::create(array('format' => 'empty_format', 'name' => 'Empty format'));
     $format->save();
     $this->verifyTextFormat($format);
     // Add another text format specifying all possible properties.
     $format = FilterFormat::create(array('format' => 'custom_format', 'name' => 'Custom format'));
     $format->setFilterConfig('filter_url', array('status' => 1, 'settings' => array('filter_url_length' => 30)));
     $format->save();
     $this->verifyTextFormat($format);
     // Alter some text format properties and save again.
     $format->set('name', 'Altered format');
     $format->setFilterConfig('filter_url', array('status' => 0));
     $format->setFilterConfig('filter_autop', array('status' => 1));
     $format->save();
     $this->verifyTextFormat($format);
     // Add a filter_test_replace  filter and save again.
     $format->setFilterConfig('filter_test_replace', array('status' => 1));
     $format->save();
     $this->verifyTextFormat($format);
     // Disable the text format.
     $format->disable()->save();
     $formats = filter_formats();
     $this->assertTrue(!isset($formats[$format->id()]), 'filter_formats: Disabled text format no longer exists.');
 }
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     // Create the necessary formats.
     $this->installConfig(array('filter'));
     FilterFormat::create(array('format' => 'no_filters', 'filters' => array()))->save();
 }
示例#8
0
 protected function setUp()
 {
     parent::setUp();
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML'));
     $filtered_html_format->save();
     $filtered_html_permission = $filtered_html_format->getPermissionName();
     user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array($filtered_html_permission));
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create a text format and associate this with CKEditor.
     FilterFormat::create(['format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => []])->save();
     Editor::create(['format' => 'full_html', 'editor' => 'ckeditor'])->save();
     // Create a new user with admin rights.
     $this->admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'administer site configuration', 'administer filters']);
 }
示例#10
0
 protected function setUp()
 {
     parent::setUp();
     // Add text format.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     // Create admin user.
     $this->adminUser = $this->drupalCreateUser(array('administer filters'));
 }
 protected function setUp()
 {
     parent::setUp();
     // Install the Filter module.
     // Create text format, associate CKEditor.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     $editor = Editor::create(['format' => 'filtered_html', 'editor' => 'ckeditor']);
     $editor->save();
 }
示例#12
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $basic_html_format = FilterFormat::load('basic_html');
     $restricted_html_format = FilterFormat::create(array('format' => 'restricted_html', 'name' => 'Restricted HTML'));
     $restricted_html_format->save();
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML'));
     $full_html_format->save();
     $this->loginAsAdmin(['access content overview', 'administer tmgmt', 'translate any entity', 'edit any translatable_node content', $basic_html_format->getPermissionName(), $restricted_html_format->getPermissionName(), $full_html_format->getPermissionName()]);
 }
示例#13
0
 protected function setUp()
 {
     parent::setUp();
     // Install the Filter module.
     // Add text formats.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => array()));
     $full_html_format->save();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->format = strtolower($this->randomMachineName());
     $filter_format = FilterFormat::create(['format' => $this->format, 'name' => $this->randomString(), 'filters' => []]);
     $filter_format->save();
     $editor = Editor::create(['format' => $this->format, 'editor' => 'ckeditor']);
     $editor->save();
     $this->adminUser = $this->drupalCreateUser(['administer filters']);
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Add text format.
     FilterFormat::create(['format' => 'basic_html', 'name' => 'Basic HTML', 'weight' => 0])->save();
     // Set up text editor.
     Editor::create(['format' => 'basic_html', 'editor' => 'unicorn', 'image_upload' => ['status' => TRUE, 'scheme' => 'public', 'directory' => 'inline-images', 'max_size' => '', 'max_dimensions' => ['width' => NULL, 'height' => NULL]]])->save();
     // Create admin user.
     $this->adminUser = $this->drupalCreateUser(['administer filters', 'use text format basic_html']);
     $this->drupalLogin($this->adminUser);
 }
示例#16
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('editor');
     $this->installEntitySchema('filter_format');
     $this->format = FilterFormat::create(['format' => 'test_format', 'name' => $this->randomMachineName()]);
     $this->format->save();
     $this->editor = Editor::create(['editor' => 'ckeditor', 'format' => 'test_format', 'settings' => ['toolbar' => ['rows' => [[['name' => 'Enabled Buttons', 'items' => ['Format']]]]]]]);
     $this->editor->save();
     $this->ckeditorPluginManager = $this->container->get('plugin.manager.ckeditor.plugin');
 }
 protected function setUp()
 {
     parent::setUp();
     // Create a text format.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array('filter_caption' => array('status' => 1))));
     $filtered_html_format->save();
     // Create a node type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     // Create one node of the above node type using the above text format.
     $this->drupalCreateNode(array('type' => 'article', 'body' => array(0 => array('value' => '<p>Do you also love Drupal?</p><img src="druplicon.png" data-caption="Druplicon" />', 'format' => 'filtered_html'))));
 }
示例#18
0
 /**
  * {@inheritdoc}
  */
 function setUp()
 {
     parent::setUp();
     $this->addLanguage('de');
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML'));
     $filtered_html_format->save();
     $this->drupalCreateContentType(array('type' => 'test_bundle'));
     $this->loginAsAdmin(array('create translation jobs', 'submit translation jobs', 'create test_bundle content', $filtered_html_format->getPermissionName()));
     file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = File::create(array('uri' => 'public://example.jpg'));
     $this->image->save();
 }
示例#19
0
 protected function setUp()
 {
     parent::setUp();
     // Install the Filter module.
     // Create text format, associate CKEditor.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array('filter_html' => array('status' => 1, 'settings' => array('allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>')))));
     $filtered_html_format->save();
     $editor = Editor::create(['format' => 'filtered_html', 'editor' => 'ckeditor']);
     $editor->save();
     // Create "CKEditor" text editor plugin instance.
     $this->ckeditor = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
 }
 /**
  * Tests [entity:field_name] tokens.
  */
 public function testEntityFieldTokens()
 {
     // Create a node with a value in the text field and test its token.
     $format = FilterFormat::create(['format' => 'test', 'weight' => 1, 'filters' => ['filter_html_escape' => ['status' => TRUE]]]);
     $format->save();
     $entity = Node::create(['title' => 'Test node title', 'type' => 'article', 'test_field' => ['value' => 'foo', 'format' => $format->id()]]);
     $entity->save();
     $this->assertTokens('node', ['node' => $entity], ['test_field' => Markup::create('foo')]);
     // Create a node without a value in the text field and test its token.
     $entity = Node::create(['title' => 'Test node title', 'type' => 'article']);
     $entity->save();
     $this->assertNoTokens('node', ['node' => $entity], ['test_field']);
 }
示例#21
0
 /**
  * {@inheritdoc}
  */
 function setUp()
 {
     parent::setUp();
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML'));
     $filtered_html_format->save();
     $this->addLanguage('de');
     $this->addLanguage('es');
     $this->addLanguage('el');
     // Login as translator only with limited permissions to run these tests.
     $this->loginAsTranslator(array('access administration pages', 'create translation jobs', 'submit translation jobs', $filtered_html_format->getPermissionName()), TRUE);
     $this->drupalPlaceBlock('system_breadcrumb_block');
     $this->createNodeType('page', 'Page', TRUE);
     $this->createNodeType('article', 'Article', TRUE);
 }
 protected function setUp()
 {
     parent::setUp();
     // Setup Filtered HTML text format.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'filters' => array('filter_html' => array('status' => 1, 'settings' => array('allowed_html' => '<img src testattribute> <a>')), 'filter_autop' => array('status' => 1), 'filter_html_image_secure' => array('status' => 1))));
     $filtered_html_format->save();
     // Setup users.
     $this->webUser = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_format->getPermissionName()));
     $this->drupalLogin($this->webUser);
     // Setup a node to comment and test on.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Add a comment field.
     $this->addDefaultCommentField('node', 'page');
     $this->node = $this->drupalCreateNode();
 }
示例#23
0
文件: FieldTest.php 项目: Wylbur/gj
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('user');
     $this->installEntitySchema('node');
     // Create the article content type with a text field.
     $node_type = NodeType::create(['type' => 'article']);
     $node_type->save();
     $field_storage = FieldStorageConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'type' => 'text']);
     $field_storage->save();
     $field = FieldConfig::create(['field_name' => 'test_field', 'entity_type' => 'node', 'bundle' => 'article', 'label' => 'Test field']);
     $field->save();
     $this->testFormat = FilterFormat::create(['format' => 'test', 'weight' => 1, 'filters' => ['filter_html_escape' => ['status' => TRUE]]]);
     $this->testFormat->save();
 }
 protected function setUp()
 {
     parent::setUp();
     // Create a text format.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     // Create a node type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     // Create one node of the above node type using the above text format.
     $this->drupalCreateNode(array('type' => 'article', 'body' => array(0 => array('value' => '<p>How are you?</p>', 'format' => 'filtered_html')), 'revision_log' => $this->randomString()));
     // Create 2 users, the only difference being the ability to use in-place
     // editing
     $basic_permissions = array('access content', 'create article content', 'edit any article content', 'use text format filtered_html', 'access contextual links');
     $this->authorUser = $this->drupalCreateUser($basic_permissions);
     $this->editorUser = $this->drupalCreateUser(array_merge($basic_permissions, array('access in-place editing')));
 }
示例#25
0
 /**
  * Tests relative, root-relative, protocol-relative and absolute URLs.
  */
 public function testUrlHandling()
 {
     // Only the plain_text text format is available by default, which escapes
     // all HTML.
     FilterFormat::create(['format' => 'full_html', 'name' => 'Full HTML', 'filters' => []])->save();
     $defaults = ['type' => 'article', 'promote' => 1];
     $this->drupalCreateNode($defaults + ['body' => ['value' => '<p><a href="' . file_url_transform_relative(file_create_url('public://root-relative')) . '">Root-relative URL</a></p>', 'format' => 'full_html']]);
     $protocol_relative_url = substr(file_create_url('public://protocol-relative'), strlen(\Drupal::request()->getScheme() . ':'));
     $this->drupalCreateNode($defaults + ['body' => ['value' => '<p><a href="' . $protocol_relative_url . '">Protocol-relative URL</a></p>', 'format' => 'full_html']]);
     $absolute_url = file_create_url('public://absolute');
     $this->drupalCreateNode($defaults + ['body' => ['value' => '<p><a href="' . $absolute_url . '">Absolute URL</a></p>', 'format' => 'full_html']]);
     $this->drupalGet('rss.xml');
     $this->assertRaw(file_create_url('public://root-relative'), 'Root-relative URL is transformed to absolute.');
     $this->assertRaw($protocol_relative_url, 'Protocol-relative URL is left untouched.');
     $this->assertRaw($absolute_url, 'Absolute URL is left untouched.');
 }
 protected function setUp()
 {
     parent::setUp();
     // Install the Filter module.
     // Create a field.
     $this->fieldName = 'field_textarea';
     $this->createFieldWithStorage($this->fieldName, 'text', 1, 'Long text field', array(), 'text_textarea', array('size' => 42), 'text_default', array());
     // Create text format.
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => array()));
     $full_html_format->save();
     // Associate text editor with text format.
     $editor = Editor::create(['format' => $full_html_format->id(), 'editor' => 'unicorn']);
     $editor->save();
     // Also create a text format without an associated text editor.
     FilterFormat::create(array('format' => 'no_editor', 'name' => 'No Text Editor', 'weight' => 2, 'filters' => array()))->save();
 }
示例#27
0
 protected function setUp()
 {
     parent::setUp();
     // Create text format, associate CKEditor.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     $editor = Editor::create(['format' => 'filtered_html', 'editor' => 'ckeditor']);
     $editor->save();
     // Create a second format without an associated editor so a drop down select
     // list is created when selecting formats.
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML', 'weight' => 1, 'filters' => array()));
     $full_html_format->save();
     // Create node type.
     $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
     $this->untrustedUser = $this->drupalCreateUser(array('create article content', 'edit any article content'));
     $this->normalUser = $this->drupalCreateUser(array('create article content', 'edit any article content', 'use text format filtered_html', 'use text format full_html'));
 }
示例#28
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Set front page so we have someplace to redirect to for invalid Cart Links.
     \Drupal::configFactory()->getEditable('system.site')->set('page.front', '/node')->save();
     // Need page_title_block because we test page titles
     $this->drupalPlaceBlock('page_title_block');
     // System help block is needed to see output from hook_help().
     $this->drupalPlaceBlock('help_block', array('region' => 'help'));
     // Testing profile doesn't include a 'page' content type.
     // We will need this to create pages with links on them.
     $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
     // Create Full HTML text format, needed because we want links
     // to appear on pages.
     $full_html_format = FilterFormat::create(array('format' => 'full_html', 'name' => 'Full HTML'));
     $full_html_format->save();
 }
示例#29
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Create Filtered HTML text format and enable entity_embed filter.
     $format = FilterFormat::create(['format' => 'embed_test', 'name' => 'Embed format', 'filters' => []]);
     $format->save();
     $editor_group = ['name' => 'Embed', 'items' => ['embed_test_default']];
     $editor = Editor::create(['format' => 'embed_test', 'editor' => 'ckeditor', 'settings' => ['toolbar' => ['rows' => [[$editor_group]]]]]);
     $editor->save();
     // Create a user with required permissions.
     $this->adminUser = $this->drupalCreateUser(['administer embed buttons', 'use text format embed_test']);
     // Create a user with required permissions.
     $this->webUser = $this->drupalCreateUser(['use text format embed_test']);
     // Set up some standard blocks for the testing theme (Classy).
     // @see https://www.drupal.org/node/507488?page=1#comment-10291517
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
 }
示例#30
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('node', array('node_access'));
     $this->installSchema('file', array('file_usage'));
     $this->installConfig(['node']);
     // Add text formats.
     $filtered_html_format = FilterFormat::create(array('format' => 'filtered_html', 'name' => 'Filtered HTML', 'weight' => 0, 'filters' => array()));
     $filtered_html_format->save();
     // Set cardinality for body field.
     FieldStorageConfig::loadByName('node', 'body')->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)->save();
     // Set up text editor.
     $editor = Editor::create(['format' => 'filtered_html', 'editor' => 'unicorn']);
     $editor->save();
     // Create a node type for testing.
     $type = NodeType::create(['type' => 'page', 'name' => 'page']);
     $type->save();
     node_add_body_field($type);
 }