function FileUploadTest::createEntity

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::createEntity()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::createEntity()
  3. 10 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::createEntity()

Overrides ResourceTestBase::createEntity

File

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

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

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