You are here

public function AcquiaContentHubSerializerTestBase::createNode in Acquia Content Hub 8.2

Create node entity.

Parameters

array $values: Additional fields array.

Return value

\Drupal\node\NodeInterface The created node entity.

5 calls to AcquiaContentHubSerializerTestBase::createNode()
CreateNewRevisionTest::testNewRevision in tests/src/Kernel/EventSubscriber/PreEntitySave/CreateNewRevisionTest.php
Tests CreateNewRevision event subscriber.
EntitySubqueuePreSaveTest::testNewRevision in tests/src/Kernel/EventSubscriber/PreEntitySave/EntitySubqueuePreSaveTest.php
Tests CreateNewRevision event subscriber.
MetatagFieldSerializerTest::testTransformMetatagValues in modules/acquia_contenthub_metatag/tests/src/Kernel/EventSubscriber/SerializeContentField/MetatagFieldSerializerTest.php
Tests the serialization of the metatag field.
PathFieldSerializerTest::testNodePathFieldSerialization in tests/src/Kernel/EventSubscriber/SerializeContentField/PathFieldSerializerTest.php
Tests the serialization of the node path field.
PathFieldSerializerTest::testPathFieldSerialization in tests/src/Kernel/EventSubscriber/SerializeContentField/PathFieldSerializerTest.php
Tests the serialization of the path field.

File

tests/src/Kernel/AcquiaContentHubSerializerTestBase.php, line 166

Class

AcquiaContentHubSerializerTestBase
Base class for testing serialization.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function createNode(array $values = []) : NodeInterface {
  $data = [
    'title' => $this
      ->randomMachineName(),
    'type' => self::BUNDLE,
    'created' => \Drupal::time()
      ->getRequestTime(),
    'changed' => \Drupal::time()
      ->getRequestTime(),
    'uid' => 1,
  ];
  $data = array_merge($data, $values);

  // Create node.
  $entity = Node::create($data);
  $entity
    ->save();
  return $entity;
}