You are here

public function ExtraFieldFormPluginTest::testFormPlugin in Extra Field 8.2

Tests basic form plugins.

@covers \Drupal\extra_field\Plugin\ExtraFieldFormBase::formElement

@dataProvider formPluginProvider

Parameters

string $pluginId: Plugin ID of the plugin under test.

array $output: Plugin output as returned by ::formElement.

File

tests/src/Kernel/ExtraFieldFormPluginTest.php, line 38

Class

ExtraFieldFormPluginTest
Kernel test for Extra Field form plugins.

Namespace

Drupal\Tests\extra_field\Kernel

Code

public function testFormPlugin($pluginId, array $output) {
  switch ($pluginId) {
    case 'single_item_test':
      $extraField = new SingleItemTest([], $pluginId, []);
      break;
  }
  $form = [];
  $formState = new FormState();
  $pluginOutput = $extraField
    ->formElement($form, $formState);
  $this
    ->assertEquals($output, $pluginOutput);
}