function NodeResourceTestBase::createEntity
Same name in other branches
- 9 core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::createEntity()
- 8.9.x core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::createEntity()
- 10 core/modules/node/tests/src/Functional/Rest/NodeResourceTestBase.php \Drupal\Tests\node\Functional\Rest\NodeResourceTestBase::createEntity()
Overrides EntityResourceTestBase::createEntity
1 call to NodeResourceTestBase::createEntity()
- ModeratedNodeResourceTestBase::createEntity in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ ModeratedNode/ ModeratedNodeResourceTestBase.php
1 method overrides NodeResourceTestBase::createEntity()
- ModeratedNodeResourceTestBase::createEntity in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ ModeratedNode/ ModeratedNodeResourceTestBase.php
File
-
core/
modules/ node/ tests/ src/ Functional/ Rest/ NodeResourceTestBase.php, line 84
Class
Namespace
Drupal\Tests\node\Functional\RestCode
protected function createEntity() {
if (!NodeType::load('camelids')) {
// Create a "Camelids" node type.
NodeType::create([
'name' => 'Camelids',
'type' => 'camelids',
])->save();
}
// Create a "Llama" node.
$node = Node::create([
'type' => 'camelids',
]);
$node->setTitle('Llama')
->setOwnerId(static::$auth ? $this->account
->id() : 0)
->setPublished()
->setCreatedTime(123456789)
->setChangedTime(123456789)
->setRevisionCreationTime(123456789)
->set('path', '/llama')
->save();
return $node;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.