You are here

protected function PluginSelectTest::createField in Commerce Core 8.2

Creates a commerce_plugin_item field for the given plugin type.

Parameters

string $plugin_type: The plugin type.

3 calls to PluginSelectTest::createField()
PluginSelectTest::testPluginRadios in tests/src/FunctionalJavascript/PluginSelectTest.php
Tests the plugin_radios widget.
PluginSelectTest::testPluginSelect in tests/src/FunctionalJavascript/PluginSelectTest.php
Tests the plugin_select widget.
PluginSelectTest::testPluginSelectWithoutConfiguration in tests/src/FunctionalJavascript/PluginSelectTest.php
Tests the plugin_select widget on a plugin type without configuration.

File

tests/src/FunctionalJavascript/PluginSelectTest.php, line 159

Class

PluginSelectTest
Tests the plugin select widgets.

Namespace

Drupal\Tests\commerce\FunctionalJavascript

Code

protected function createField($plugin_type) {
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'test_plugin',
    'entity_type' => 'entity_test',
    'type' => 'commerce_plugin_item:' . $plugin_type,
  ]);
  $field_storage
    ->save();
  $field = FieldConfig::create([
    'field_name' => 'test_plugin',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ]);
  $field
    ->save();
}