You are here

protected function EntityBrowserTest::loadTests in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/Extension/EntityBrowserTest.php \Drupal\Tests\entity_browser\Kernel\Extension\EntityBrowserTest::loadTests()

Tests the loading of entity browser.

1 call to EntityBrowserTest::loadTests()
EntityBrowserTest::testEntityBrowserCrud in tests/src/Kernel/Extension/EntityBrowserTest.php
Tests CRUD operations.

File

tests/src/Kernel/Extension/EntityBrowserTest.php, line 202

Class

EntityBrowserTest
Tests the entity_browser config entity.

Namespace

Drupal\Tests\entity_browser\Kernel\Extension

Code

protected function loadTests() {

  /** @var \Drupal\entity_browser\EntityBrowserInterface $entity */
  $entity = $this->controller
    ->load('test_browser');
  $this
    ->assertTrue($entity instanceof EntityBrowserInterface, 'The loaded entity is an entity browser.');

  // Verify several properties of the entity browser.
  $this
    ->assertEquals($entity
    ->label(), 'Testing entity browser instance');
  $this
    ->assertTrue($entity
    ->uuid());
  $plugin = $entity
    ->getDisplay();
  $this
    ->assertTrue($plugin instanceof DisplayInterface, 'Testing display plugin.');
  $this
    ->assertEquals($plugin
    ->getPluginId(), 'standalone');
  $plugin = $entity
    ->getSelectionDisplay();
  $this
    ->assertTrue($plugin instanceof SelectionDisplayInterface, 'Testing selection display plugin.');
  $this
    ->assertEquals($plugin
    ->getPluginId(), 'no_display');
  $plugin = $entity
    ->getWidgetSelector();
  $this
    ->assertTrue($plugin instanceof WidgetSelectorInterface, 'Testing widget selector plugin.');
  $this
    ->assertEquals($plugin
    ->getPluginId(), 'single');
  $plugin = $entity
    ->getWidget($this->widgetUUID);
  $this
    ->assertTrue($plugin instanceof WidgetInterface, 'Testing widget plugin.');
  $this
    ->assertEquals($plugin
    ->getPluginId(), 'view');
}