You are here

protected function FileUploadTest::createEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::createEntity()

Creates the entity to be tested.

Return value

\Drupal\Core\Entity\EntityInterface The entity to be tested.

Overrides ResourceTestBase::createEntity

File

core/modules/jsonapi/tests/src/Functional/FileUploadTest.php, line 191

Class

FileUploadTest
Tests binary data file upload route.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function createEntity() {

  // Create an entity that a file can be attached to.
  $entity_test = EntityTest::create([
    'name' => 'Llama',
    'type' => 'entity_test',
  ]);
  $entity_test
    ->setOwnerId($this->account
    ->id());
  $entity_test
    ->save();
  return $entity_test;
}