You are here

protected function FileUploadTest::createEntity in JSON:API 8.2

Creates the entity to be tested.

Return value

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

Overrides ResourceTestBase::createEntity

File

tests/src/Functional/FileUploadTest.php, line 189

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;
}