You are here

protected function WidgetViewsTest::setUp in Drupal 9

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

Overrides BrowserTestBase::setUp

File

core/modules/media_library/tests/src/FunctionalJavascript/WidgetViewsTest.php, line 15

Class

WidgetViewsTest
Tests the views in the media library 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
    ->createMediaItems([
    'type_one' => [
      'Horse',
      'Bear',
      'Cat',
      'Dog',
      'Goat',
      'Sheep',
      'Pig',
      'Cow',
      'Chicken',
      'Duck',
      'Donkey',
      'Llama',
      'Mouse',
      'Goldfish',
      'Rabbit',
      'Turkey',
      'Dove',
      'Giraffe',
      'Tiger',
      'Hamster',
      'Parrot',
      'Monkey',
      'Koala',
      'Panda',
      'Kangaroo',
    ],
    'type_two' => [
      'Crocodile',
      'Lizard',
      'Snake',
      'Turtle',
    ],
  ]);

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