You are here

protected function NodeCacheTagsTest::createEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeCacheTagsTest.php \Drupal\node\Tests\NodeCacheTagsTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides EntityCacheTagsTestBase::createEntity

File

core/modules/node/src/Tests/NodeCacheTagsTest.php, line 28
Contains \Drupal\node\Tests\NodeCacheTagsTest.

Class

NodeCacheTagsTest
Tests the Node entity's cache tags.

Namespace

Drupal\node\Tests

Code

protected function createEntity() {

  // Create a "Camelids" node type.
  entity_create('node_type', array(
    'name' => 'Camelids',
    'type' => 'camelids',
  ))
    ->save();

  // Create a "Llama" node.
  $node = entity_create('node', array(
    'type' => 'camelids',
  ));
  $node
    ->setTitle('Llama')
    ->setPublished(TRUE)
    ->save();
  return $node;
}