function TemporaryJsonapiFileFieldUploaderTest::setUp

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Kernel/Controller/TemporaryJsonapiFileFieldUploaderTest.php \Drupal\Tests\jsonapi\Kernel\Controller\TemporaryJsonapiFileFieldUploaderTest::setUp()
  2. 11.x core/modules/jsonapi/tests/src/Kernel/Controller/TemporaryJsonapiFileFieldUploaderTest.php \Drupal\Tests\jsonapi\Kernel\Controller\TemporaryJsonapiFileFieldUploaderTest::setUp()

Overrides KernelTestBase::setUp

File

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

Class

TemporaryJsonapiFileFieldUploaderTest
@coversDefaultClass \Drupal\jsonapi\Controller\TemporaryJsonapiFileFieldUploader @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.