You are here

protected function ButtonAdminTest::setUp in Entity Embed 8

Overrides BrowserTestBase::setUp

File

tests/src/FunctionalJavascript/ButtonAdminTest.php, line 42

Class

ButtonAdminTest
Tests the creation and configuration of entity embed buttons.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

protected function setUp() {
  parent::setUp();
  $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_view_mode')
    ->create([
    'id' => 'media.thumb',
    'targetEntityType' => 'media',
  ])
    ->save();
  $this
    ->createContentType([
    'type' => 'article',
    'label' => 'Article',
  ]);
  $this
    ->createMediaType('image', [
    'id' => 'image',
    'label' => 'Image',
  ]);
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer embed buttons',
  ]);

  // Delete the existing node button provided by entity_embed module, so that
  // we can create a button with the same machine name.
  $this->container
    ->get('entity_type.manager')
    ->getStorage('embed_button')
    ->load('node')
    ->delete();
}