You are here

public function MediaEntityBrowserTest::setUp in Media Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/MediaEntityBrowserTest.php \Drupal\Tests\media_entity_browser\FunctionalJavascript\MediaEntityBrowserTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/MediaEntityBrowserTest.php, line 34

Class

MediaEntityBrowserTest
A test for the media entity browser.

Namespace

Drupal\Tests\media_entity_browser\FunctionalJavascript

Code

public function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array_keys($this->container
    ->get('user.permissions')
    ->getPermissions())));
  MediaBundle::create([
    'label' => 'Video',
    'id' => 'video',
    'description' => 'Video bundle.',
    'type' => 'video_embed_field',
  ])
    ->save();
  Media::create([
    'bundle' => 'video',
    'field_media_video_embed_field' => [
      [
        'value' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ',
      ],
    ],
  ])
    ->save();
}