function ItemTest::createAnotherEntity

Same name and namespace in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/ItemTest.php \Drupal\Tests\jsonapi\Functional\ItemTest::createAnotherEntity()

Creates another entity to be tested.

Parameters

mixed $key: A unique key to be used for the ID and/or label of the duplicated entity.

Return value

\Drupal\Core\Entity\EntityInterface Another entity based on $this->entity.

Overrides ResourceTestBase::createAnotherEntity

File

core/modules/aggregator/tests/src/Functional/Jsonapi/ItemTest.php, line 94

Class

ItemTest
JSON:API integration test for the "Item" content entity type.

Namespace

Drupal\Tests\aggregator\Functional\Jsonapi

Code

protected function createAnotherEntity($key) {
    $duplicate = $this->getEntityDuplicate($this->entity, $key);
    $duplicate->setLink('https://www.example.org/');
    $duplicate->save();
    return $duplicate;
}

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