You are here

public function Select2BoxesTests::testWidgetsPlugins in Select2 Boxes 8

Tests whether the widgets plugins exist and are accessible.

@todo This test should be a kernel/unit test which runs much faster.

File

tests/src/FunctionalJavascript/Select2BoxesTests.php, line 28

Class

Select2BoxesTests
Class for testing Select2Boxes.

Namespace

Drupal\Tests\select2boxes\FunctionalJavascript

Code

public function testWidgetsPlugins() {

  // Check if the plugin manager service exists.
  $this
    ->assertTrue(\Drupal::hasService('plugin.manager.field.widget'));

  /** @var \Drupal\Core\Field\WidgetPluginManager $plugin_manager */
  $plugin_manager = \Drupal::service('plugin.manager.field.widget');

  // Check each plugin if it has definition under a plugin manager service.
  foreach (static::$pluginIds as $widget) {
    $this
      ->assertTrue($plugin_manager
      ->hasDefinition($widget));
  }
}