You are here

private function MetatagHelperTrait::createContentTypeNode in Metatag 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.

Return value

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

7 calls to MetatagHelperTrait::createContentTypeNode()
DefaultTags::testNode in tests/src/Functional/DefaultTags.php
Test the default values for a Node entity.
DisabledDefaultTags::testEntityBundleDefaults in tests/src/Functional/DisabledDefaultTags.php
Test that a disabled node bundle metatag default doesn't load.
DisabledDefaultTags::testEntityTypeDefaults in tests/src/Functional/DisabledDefaultTags.php
Test that a disabled Node metatag default doesn't load.
EnsureDevelWorks::testNode in tests/src/Functional/EnsureDevelWorks.php
Make sure that the system still works when some example content exists.
MetatagPanelizerTest::testPanelizerMetatagPreRender in tests/src/Functional/MetatagPanelizerTest.php
Create an entity, view its JSON output, confirm Metatag data exists.

... See full list

File

tests/src/Functional/MetatagHelperTrait.php, line 64

Class

MetatagHelperTrait
Misc helper functions for the automated tests.

Namespace

Drupal\Tests\metatag\Functional

Code

private function createContentTypeNode($title = 'Title test', $body = 'Body test') {
  $content_type = 'metatag_test';
  $args = [
    'type' => $content_type,
    'label' => 'Test content type',
  ];
  $this
    ->createContentType($args);
  $args = [
    'body' => [
      [
        'value' => $body,
        'format' => filter_default_format(),
      ],
    ],
    'title' => $title,
    'type' => $content_type,
  ];
  return $this
    ->createNode($args);
}