protected function NodeCacheTagsTest::createEntity in Drupal 8
Same name and namespace in other branches
- 9 core/modules/node/tests/src/Functional/NodeCacheTagsTest.php \Drupal\Tests\node\Functional\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/ tests/ src/ Functional/ NodeCacheTagsTest.php, line 30
Class
- NodeCacheTagsTest
- Tests the Node entity's cache tags.
Namespace
Drupal\Tests\node\FunctionalCode
protected function createEntity() {
// Create a "Camelids" node type.
NodeType::create([
'name' => 'Camelids',
'type' => 'camelids',
])
->save();
// Create a "Llama" node.
$node = Node::create([
'type' => 'camelids',
]);
$node
->setTitle('Llama')
->setPublished()
->save();
return $node;
}