You are here

protected function TemporaryJsonapiFileFieldUploaderTest::setUp in Drupal 10

Overrides KernelTestBase::setUp

File

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

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('system', [
    'sequences',
  ]);
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $this
    ->installSchema('user', [
    'users_data',
  ]);
  NodeType::create([
    'type' => 'lorem',
  ])
    ->save();
  $type = NodeType::create([
    'type' => 'article',
  ]);
  $type
    ->save();
  $type = NodeType::create([
    'type' => '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();
}