function FileTest::createAnotherEntity

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

Overrides ResourceTestBase::createAnotherEntity

File

core/modules/jsonapi/tests/src/Functional/FileTest.php, line 120

Class

FileTest
JSON:API integration test for the "File" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createAnotherEntity($key) {
    
    /** @var \Drupal\file\FileInterface $duplicate */
    $duplicate = parent::createAnotherEntity($key);
    $duplicate->setFileUri("public://{$key}.txt");
    $duplicate->save();
    return $duplicate;
}

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