function ItemResourceTestBase::createAnotherEntity

Same name in other branches
  1. 9 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 84

Class

ItemResourceTestBase
ResourceTestBase for Item entity.

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.