You are here

public function AdvancedPluginSelectorBaseTest::testSubmitSelectorForm in Plugin 8.2

@covers ::submitSelectorForm

File

tests/src/Unit/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBaseTest.php, line 305

Class

AdvancedPluginSelectorBaseTest
@coversDefaultClass \Drupal\plugin\Plugin\Plugin\PluginSelector\AdvancedPluginSelectorBase

Namespace

Drupal\Tests\plugin\Unit\Plugin\Plugin\PluginSelector

Code

public function testSubmitSelectorForm() {
  $form = [
    'container' => [
      'plugin_form' => [
        $this
          ->randomMachineName() => [],
      ],
    ],
  ];
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $plugin = $this
    ->getMockForAbstractClass(AdvancedPluginSelectorBaseUnitTestPluginFormPluginInterface::class);
  $plugin
    ->expects($this
    ->once())
    ->method('submitConfigurationForm')
    ->with($form['container']['plugin_form'], $form_state);
  $this->sut
    ->submitSelectorForm($form, $form_state);
  $this->sut
    ->setSelectedPlugin($plugin);
  $this->sut
    ->submitSelectorForm($form, $form_state);
}