You are here

protected function EntityReferenceWidgetTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php \Drupal\Tests\media_library\FunctionalJavascript\EntityReferenceWidgetTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php, line 29

Class

EntityReferenceWidgetTest
Tests the Media library entity reference widget.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();

  // Create a few example media items for use in selection.
  $this->mediaItems = $this
    ->createMediaItems([
    'type_one' => [
      'Horse',
      'Bear',
      'Cat',
      'Dog',
    ],
    'type_two' => [
      'Crocodile',
      'Lizard',
      'Snake',
      'Turtle',
    ],
  ]);

  // Create a user who can use the Media library.
  $user = $this
    ->drupalCreateUser([
    'access content',
    'create basic_page content',
    'edit own basic_page content',
    'view media',
    'create media',
    'administer node form display',
  ]);
  $this
    ->drupalLogin($user);
}