You are here

protected function SingleItemTest::setUp in Media Library Form API Element 8

Same name and namespace in other branches
  1. 2.x tests/src/FunctionalJavascript/SingleItemTest.php \Drupal\Tests\media_library_form_element\FunctionalJavascript\SingleItemTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/SingleItemTest.php, line 45

Class

SingleItemTest
Test using the media library element with cardinality 1.

Namespace

Drupal\Tests\media_library_form_element\FunctionalJavascript

Code

protected function setUp() {

  // Bypass the need in the test module to define schema.
  $this->strictConfigSchema = NULL;
  parent::setUp();
  $this
    ->createMediaItems([
    'type_one' => [
      'Horse',
      'Bear',
      'Cat',
      'Dog',
    ],
    'type_two' => [
      'Crocodile',
      'Lizard',
      'Snake',
      'Turtle',
    ],
  ]);

  // Create a user that can only add media of type one.
  $user = $this
    ->drupalCreateUser([
    'access administration pages',
    'access content',
    'create type_one media',
    'view media',
  ]);
  $this
    ->drupalLogin($user);
}