You are here

protected function ScannerTestBase::createContentTypeNode in Search and Replace Scanner 8

Create a content type and a node.

Parameters

string $title: A title for the node that will be returned.

string $body: The text to use as the body.

string $content_type: The node bundle type.

string $content_type_label: The content type label.

Return value

\Drupal\node\NodeInterface A fully formatted node object.

1 call to ScannerTestBase::createContentTypeNode()
ScannerAdminTest::setUp in tests/src/Functional/ScannerAdminTest.php

File

tests/src/Functional/ScannerTestBase.php, line 45

Class

ScannerTestBase
Helper test class with some added functions for testing.

Namespace

Drupal\Tests\scanner\Functional

Code

protected function createContentTypeNode($title, $body, $content_type, $content_type_label) {
  $args = [
    'type' => $content_type,
    'name' => $content_type_label,
  ];
  $this
    ->createContentType($args);
  $args = [
    'body' => [
      [
        'value' => $body,
        'format' => filter_default_format(),
      ],
    ],
    'title' => $title,
    'type' => $content_type,
  ];
  return $this
    ->createNode($args);
}