You are here

protected function EntityQueryAlterCacheabilityTest::createNode in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/EntityQueryAlterCacheabilityTest.php \Drupal\Tests\group\Kernel\EntityQueryAlterCacheabilityTest::createNode()

Creates a node.

Parameters

array $values: (optional) The values used to create the entity.

Return value

\Drupal\node\Entity\Node The created node entity.

1 call to EntityQueryAlterCacheabilityTest::createNode()
EntityQueryAlterCacheabilityTest::testCacheableMetadataLeaks in tests/src/Kernel/EntityQueryAlterCacheabilityTest.php
Tests that cacheable metadata is only bubbled when there is any.

File

tests/src/Kernel/EntityQueryAlterCacheabilityTest.php, line 100

Class

EntityQueryAlterCacheabilityTest
Tests grouped entities query access cacheability.

Namespace

Drupal\Tests\group\Kernel

Code

protected function createNode(array $values = []) {
  $node = $this->storage
    ->create($values + [
    'title' => $this
      ->randomString(),
  ]);
  $node
    ->enforceIsNew();
  $this->storage
    ->save($node);
  return $node;
}