function WidgetOverflowTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/media_library/tests/src/FunctionalJavascript/WidgetOverflowTest.php, line 31

Class

WidgetOverflowTest
Tests that uploads in the 'media_library_widget' works as expected.

Namespace

Drupal\Tests\media_library\FunctionalJavascript

Code

protected function setUp() : void {
  parent::setUp();
  foreach ($this->getTestFiles('image') as $image) {
    $extension = pathinfo($image->filename, PATHINFO_EXTENSION);
    if ($extension === 'png') {
      $this->image = $image;
    }
  }
  if (!isset($this->image)) {
    $this->fail('Expected test files not present.');
  }
  // Create a user that can only add media of type four.
  $user = $this->drupalCreateUser([
    'access administration pages',
    'access content',
    'create basic_page content',
    'create type_one media',
    'create type_three media',
    'view media',
  ]);
  $this->drupalLogin($user);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.