function WidgetAnonymousTest::setUp

Same name in other branches
  1. 9 core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php \Drupal\Tests\media_library\FunctionalJavascript\WidgetAnonymousTest::setUp()
  2. 8.9.x core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php \Drupal\Tests\media_library\FunctionalJavascript\WidgetAnonymousTest::setUp()
  3. 11.x core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php \Drupal\Tests\media_library\FunctionalJavascript\WidgetAnonymousTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/media_library/tests/src/FunctionalJavascript/WidgetAnonymousTest.php, line 25

Class

WidgetAnonymousTest
Tests that the widget works as expected for anonymous users.

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' => [
            'Cat',
            'Dog',
        ],
    ]);
    // Allow the anonymous user to create pages and view media.
    $role = Role::load(RoleInterface::ANONYMOUS_ID);
    $this->grantPermissions($role, [
        'access content',
        'create basic_page content',
        'view media',
    ]);
}

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