function ItemResourceTestBase::createAnotherEntity

Same name in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php \Drupal\Tests\aggregator\Functional\Rest\ItemResourceTestBase::createAnotherEntity()

Overrides EntityResourceTestBase::createAnotherEntity

File

core/modules/aggregator/tests/src/Functional/Rest/ItemResourceTestBase.php, line 82

Class

ItemResourceTestBase
ResourceTestBase for Item entity. @group legacy

Namespace

Drupal\Tests\aggregator\Functional\Rest

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.