protected function ItemResourceTestBase::createAnotherEntity in Drupal 9
Same name and namespace in other branches
- 8 core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php \Drupal\Tests\aggregator\Functional\Rest\ItemResourceTestBase::createAnotherEntity()
Creates another entity to be tested.
Return value
\Drupal\Core\Entity\EntityInterface Another entity based on $this->entity.
Overrides EntityResourceTestBase::createAnotherEntity
File
- core/
modules/ aggregator/ tests/ src/ Functional/ Rest/ ItemResourceTestBase.php, line 81
Class
- ItemResourceTestBase
- ResourceTestBase for Item entity.
Namespace
Drupal\Tests\aggregator\Functional\RestCode
protected function createAnotherEntity() {
$entity = $this->entity
->createDuplicate();
$entity
->setLink('https://www.example.org/');
$label_key = $entity
->getEntityType()
->getKey('label');
if ($label_key) {
$entity
->set($label_key, $entity
->label() . '_dupe');
}
$entity
->save();
return $entity;
}