You are here

public function FilterSettingsTest::dataProvider in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::dataProvider()
  2. 9 core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::dataProvider()

The test data provider.

Return value

array

File

core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php, line 47

Class

FilterSettingsTest
Unit tests of the filter_settings plugin.

Namespace

Drupal\Tests\filter\Kernel\Plugin\migrate\process

Code

public function dataProvider() {
  return [
    // Tests that the transformed value is identical to the input value when
    // destination is not the filter_html.
    // Test with an empty source array.
    [
      [],
      'any_filter',
      [],
    ],
    // Test with a source string.
    [
      'a string',
      'any_filter',
      'a string',
    ],
    // Test with a source filter array.
    [
      [
        'allowed_html' => '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>',
      ],
      'any_filter',
      [
        'allowed_html' => '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>',
      ],
    ],
    // Tests that the transformed value for 'allowed_html' is altered when the
    // destination is filter_html.
    // Test with an empty source array.
    [
      [],
      'filter_html',
      [],
    ],
    // Test with a source string.
    [
      'a string',
      'filter_html',
      'a string',
    ],
    [
      [
        'allowed_html' => '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>',
      ],
      'filter_html',
      [
        'allowed_html' => '<a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>',
      ],
    ],
    [
      [
        'foo' => 'bar',
      ],
      'filter_null',
      [],
    ],
  ];
}