function FileUploadTest::setUp

Same name in this branch
  1. 10 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::setUp()
Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::setUp()
  2. 8.9.x core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::setUp()
  3. 11.x core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::setUp()
  4. 11.x core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php \Drupal\Tests\jsonapi\Kernel\Controller\FileUploadTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/jsonapi/tests/src/Kernel/Controller/FileUploadTest.php, line 36

Class

FileUploadTest
@coversDefaultClass \Drupal\jsonapi\Controller\FileUpload @group jsonapi

Namespace

Drupal\Tests\jsonapi\Kernel\Controller

Code

protected function setUp() : void {
    parent::setUp();
    // Add the entity schemas.
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    // Add the additional table schemas.
    $this->installSchema('node', [
        'node_access',
    ]);
    $this->installSchema('user', [
        'users_data',
    ]);
    NodeType::create([
        'type' => 'lorem',
        'name' => 'Lorem',
    ])->save();
    $type = NodeType::create([
        'type' => 'article',
        'name' => 'Article',
    ]);
    $type->save();
    $type = NodeType::create([
        'type' => 'page',
        'name' => 'Page',
    ]);
    $type->save();
    $this->createEntityReferenceField('node', 'article', 'field_relationships', 'Relationship', 'node', 'default', [
        'target_bundles' => [
            'article',
        ],
    ], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
    Role::create([
        'id' => 'article_editor',
        'label' => 'article editor',
        'permissions' => [
            'access content',
            'create article content',
            'edit any article content',
        ],
    ])->save();
    Role::create([
        'id' => 'page_editor',
        'label' => 'page editor',
        'permissions' => [
            'access content',
            'create page content',
            'edit any page content',
        ],
    ])->save();
    Role::create([
        'id' => 'editor',
        'label' => 'editor',
        'permissions' => [
            'bypass node access',
        ],
    ])->save();
}

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