function TextWithSummaryTokenReplaceTest::setUp
Overrides TokenReplaceKernelTestBase::setUp
File
- 
              core/modules/ node/ tests/ src/ Kernel/ TextWithSummaryTokenReplaceTest.php, line 33 
Class
- TextWithSummaryTokenReplaceTest
- Tests node token replacement for text_with_summary.
Namespace
Drupal\Tests\node\KernelCode
protected function setUp() : void {
  parent::setUp();
  $this->installConfig([
    'filter',
    'node',
  ]);
  // We don't create a default body field as we need a text_with_summary.
  $this->createContentType([
    'type' => 'article',
    'name' => 'Article',
  ], FALSE);
  FieldStorageConfig::create([
    'field_name' => 'body',
    'type' => 'text_with_summary',
    'entity_type' => 'node',
    'cardinality' => 1,
    'persist_with_no_fields' => TRUE,
  ])->save();
  $fieldStorage = FieldStorageConfig::loadByName('node', 'body');
  FieldConfig::create([
    'field_storage' => $fieldStorage,
    'bundle' => 'article',
    'label' => 'Body',
    'settings' => [
      'display_summary' => TRUE,
      'allowed_formats' => [],
    ],
  ])->save();
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
