You are here

public function PluginsTest::testStandaloneDisplay in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/PluginsTest.php \Drupal\Tests\entity_browser\FunctionalJavascript\PluginsTest::testStandaloneDisplay()

Tests Entity browser standalone display plugin.

File

tests/src/FunctionalJavascript/PluginsTest.php, line 212

Class

PluginsTest
Tests the entity_browser plugins.

Namespace

Drupal\Tests\entity_browser\FunctionalJavascript

Code

public function testStandaloneDisplay() {
  $image = $this
    ->createFile('lama');
  $standalone_configuration = [
    'entity_browser_id' => 'test_entity_browser_file',
    'path' => 'test',
  ];
  $this
    ->getEntityBrowser('test_entity_browser_file', 'standalone', 'single', 'no_display', $standalone_configuration);
  $this
    ->drupalGet('test');
  $this
    ->assertSession()
    ->buttonExists('Select entities');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Select entities');
  $this
    ->getSession()
    ->getPage()
    ->checkField('entity_browser_select[file:' . $image
    ->id() . ']');
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Select entities');

  // TODO test if entities were selected. Will most likely need a custom event
  // subscriber that displays a message or something along those lines.
}