function IconPackManagerKernelTest::testGetExtractorPluginForms

Test the IconPackManager::getExtractorPluginForms method.

File

core/tests/Drupal/KernelTests/Core/Theme/Icon/IconPackManagerKernelTest.php, line 172

Class

IconPackManagerKernelTest
Tests values are from test module icon_test.

Namespace

Drupal\KernelTests\Core\Theme\Icon

Code

public function testGetExtractorPluginForms() : void {
  $form_state = $this->getMockBuilder('Drupal\\Core\\Form\\FormState')
    ->disableOriginalConstructor()
    ->getMock();
  $form = [];
  $this->pluginManagerIconPack
    ->getExtractorPluginForms($form, $form_state);
  // @see core/modules/system/tests/modules/icon_test/icon_test.icons.yml
  $this->assertCount(4, array_keys($form));
  $expected = [
    'test_path',
    'test_svg',
    'test_svg_sprite',
    'test_settings',
  ];
  $this->assertSame($expected, array_keys($form));
  $expected = [
    '#type',
    '#title',
    'width',
    'height',
    'title',
  ];
  $this->assertSame($expected, array_keys($form['test_path']));
  $expected = [
    '#type',
    '#title',
    'width',
    'height',
  ];
  $this->assertSame($expected, array_keys($form['test_svg_sprite']));
  $expected = [
    '#type',
    '#title',
    'width',
    'height',
    'title',
    'alt',
    'select',
    'select_string',
    'boolean',
    'decimal',
    'number',
  ];
  $this->assertSame($expected, array_keys($form['test_settings']));
  // No form if no settings.
  $this->assertArrayNotHasKey('test_no_settings', $form);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.