function FileTest::createAnotherEntity

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/FileTest.php \Drupal\Tests\jsonapi\Functional\FileTest::createAnotherEntity()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/FileTest.php \Drupal\Tests\jsonapi\Functional\FileTest::createAnotherEntity()
  3. 10 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 124

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.