protected function BlockContentCacheTagsTest::createEntity in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php \Drupal\block_content\Tests\BlockContentCacheTagsTest::createEntity()
Creates the entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface The entity to be tested.
Overrides EntityCacheTagsTestBase::createEntity
File
- core/
modules/ block_content/ src/ Tests/ BlockContentCacheTagsTest.php, line 31 - Contains \Drupal\block_content\Tests\BlockContentCacheTagsTest.
Class
- BlockContentCacheTagsTest
- Tests the Custom Block entity's cache tags.
Namespace
Drupal\block_content\TestsCode
protected function createEntity() {
$block_content_type = entity_create('block_content_type', array(
'id' => 'basic',
'label' => 'basic',
'revision' => FALSE,
));
$block_content_type
->save();
block_content_add_body_field($block_content_type
->id());
// Create a "Llama" custom block.
$block_content = entity_create('block_content', array(
'info' => 'Llama',
'type' => 'basic',
'body' => array(
'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
'format' => 'plain_text',
),
));
$block_content
->save();
return $block_content;
}