function FilterSettingsTest::dataProvider

Same name in other branches
  1. 9 core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::dataProvider()
  2. 8.9.x core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::dataProvider()
  3. 11.x 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 49

Class

FilterSettingsTest
Unit tests of the filter_settings plugin.

Namespace

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

Code

public static 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',
            [],
        ],
    ];
}

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