You are here

private function FieldUiTest::createTestNode in Field Formatter Filter 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/FieldUiTest.php \Drupal\Tests\field_formatter_filter\Kernel\FieldUiTest::createTestNode()

Create a node with sample content.

Parameters

$bundle:

Return value

\Drupal\Core\Entity\EntityInterface

1 call to FieldUiTest::createTestNode()
FieldUiTest::testConfiguringFilter in tests/src/Functional/FieldUiTest.php
Test enabling the filter formatter. Check before, during and after.

File

tests/src/Functional/FieldUiTest.php, line 154

Class

FieldUiTest
Tests applying the filter formatter to a node.

Namespace

Drupal\Tests\field_formatter_filter\Kernel

Code

private function createTestNode($bundle) {

  // Sample markup is in an external file - just to keep HTML out of code.
  $path = __DIR__ . '/../..';
  $body = file_get_contents($path . '/sample-markup.txt');
  $settings = [
    'type' => $bundle,
    'title' => 'Test this is filtered',
    'uid' => 1,
    'body' => [
      'value' => $body,
      'format' => 'full_html',
    ],
  ];
  return $this
    ->createNode($settings);
}