You are here

public function MediaMigrationFilterFormatTest::providerTestFilterFormatMigration in Media Migration 8

Test cases for ::testFilterFormatMigration.

Return value

array[] The test cases.

File

tests/src/Kernel/Migrate/MediaMigrationFilterFormatTest.php, line 75

Class

MediaMigrationFilterFormatTest
Tests the Media Migration altered filter format migration.

Namespace

Drupal\Tests\media_migration\Kernel\Migrate

Code

public function providerTestFilterFormatMigration() {
  return [
    'Entity embed, no image and linkit tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_ENTITY_EMBED,
      'Source' => self::TEST_DATABASE,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'entity_embed' => [
            'id' => 'entity_embed',
            'provider' => 'entity_embed',
            'status' => TRUE,
            'weight' => -3,
            'settings' => [],
          ],
        ],
      ],
    ],
    'Entity embed, image tags in text fields, but no linkit tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_ENTITY_EMBED,
      'Source' => self::TEST_DATABASE + self::FIELD_TABLES_WITH_IMAGE_TAG,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'entity_embed' => [
            'id' => 'entity_embed',
            'provider' => 'entity_embed',
            'status' => TRUE,
            'weight' => 3,
            'settings' => [],
          ],
          'filter_align' => [
            'id' => 'filter_align',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 1,
            'settings' => [],
          ],
          'filter_caption' => [
            'id' => 'filter_caption',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 2,
            'settings' => [],
          ],
        ],
      ],
    ],
    'Entity embed, linkit tags in text fields, but no img tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_ENTITY_EMBED,
      'Source' => self::TEST_DATABASE + self::FIELD_TABLES_WITH_LINKIT_TAG,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'entity_embed' => [
            'id' => 'entity_embed',
            'provider' => 'entity_embed',
            'status' => TRUE,
            'weight' => -3,
            'settings' => [],
          ],
          'linkit' => [
            'id' => 'linkit',
            'provider' => 'linkit',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [
              'title' => TRUE,
            ],
          ],
        ],
      ],
    ],
    'Entity embed, image and linkit tags in text fields' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_ENTITY_EMBED,
      'Source' => self::TEST_DATABASE + NestedArray::mergeDeep(self::FIELD_TABLES_WITH_IMAGE_TAG, self::FIELD_TABLES_WITH_LINKIT_TAG),
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'entity_embed' => [
            'id' => 'entity_embed',
            'provider' => 'entity_embed',
            'status' => TRUE,
            'weight' => 3,
            'settings' => [],
          ],
          'filter_align' => [
            'id' => 'filter_align',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 1,
            'settings' => [],
          ],
          'filter_caption' => [
            'id' => 'filter_caption',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 2,
            'settings' => [],
          ],
          'linkit' => [
            'id' => 'linkit',
            'provider' => 'linkit',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [
              'title' => TRUE,
            ],
          ],
        ],
      ],
    ],
    'Media embed, no image and linkit tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED,
      'Source' => self::TEST_DATABASE,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-media data-* alt title>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'media_embed' => [
            'id' => 'media_embed',
            'provider' => 'media',
            'status' => TRUE,
            'weight' => -3,
            'settings' => [
              'default_view_mode' => 'default',
              'allowed_view_modes' => [],
              'allowed_media_types' => [],
            ],
          ],
        ],
      ],
    ],
    'Media embed, image tags in text fields, but no linkit tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED,
      'Source' => self::TEST_DATABASE + self::FIELD_TABLES_WITH_IMAGE_TAG,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-media data-* alt title>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'media_embed' => [
            'id' => 'media_embed',
            'provider' => 'media',
            'status' => TRUE,
            'weight' => 3,
            'settings' => [
              'default_view_mode' => 'default',
              'allowed_view_modes' => [],
              'allowed_media_types' => [],
            ],
          ],
          'filter_align' => [
            'id' => 'filter_align',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 1,
            'settings' => [],
          ],
          'filter_caption' => [
            'id' => 'filter_caption',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 2,
            'settings' => [],
          ],
        ],
      ],
    ],
    'Media embed, linkit tags in text fields, but no img tags' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED,
      'Source' => self::TEST_DATABASE + self::FIELD_TABLES_WITH_LINKIT_TAG,
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-media data-* alt title>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'media_embed' => [
            'id' => 'media_embed',
            'provider' => 'media',
            'status' => TRUE,
            'weight' => -3,
            'settings' => [
              'default_view_mode' => 'default',
              'allowed_view_modes' => [],
              'allowed_media_types' => [],
            ],
          ],
          'linkit' => [
            'id' => 'linkit',
            'provider' => 'linkit',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [
              'title' => TRUE,
            ],
          ],
        ],
      ],
    ],
    'Media embed, image and linkit tags in text fields' => [
      'Destination filter' => MediaMigration::MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBED,
      'Source' => self::TEST_DATABASE + NestedArray::mergeDeep(self::FIELD_TABLES_WITH_IMAGE_TAG, self::FIELD_TABLES_WITH_LINKIT_TAG),
      'Expected filter format' => [
        'status' => TRUE,
        'name' => 'Filtered HTML',
        'format' => 'filtered_html',
        'weight' => 0,
        'filters' => [
          'filter_autop' => [
            'id' => 'filter_autop',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -1,
            'settings' => [],
          ],
          'filter_html' => [
            'id' => 'filter_html',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -4,
            'settings' => [
              'allowed_html' => '<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-media data-* alt title>',
              'filter_html_help' => TRUE,
              'filter_html_nofollow' => FALSE,
            ],
          ],
          'filter_htmlcorrector' => [
            'id' => 'filter_htmlcorrector',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [],
          ],
          'filter_url' => [
            'id' => 'filter_url',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => -2,
            'settings' => [
              'filter_url_length' => 72,
            ],
          ],
          'media_embed' => [
            'id' => 'media_embed',
            'provider' => 'media',
            'status' => TRUE,
            'weight' => 3,
            'settings' => [
              'default_view_mode' => 'default',
              'allowed_view_modes' => [],
              'allowed_media_types' => [],
            ],
          ],
          'filter_align' => [
            'id' => 'filter_align',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 1,
            'settings' => [],
          ],
          'filter_caption' => [
            'id' => 'filter_caption',
            'provider' => 'filter',
            'status' => TRUE,
            'weight' => 2,
            'settings' => [],
          ],
          'linkit' => [
            'id' => 'linkit',
            'provider' => 'linkit',
            'status' => TRUE,
            'weight' => 0,
            'settings' => [
              'title' => TRUE,
            ],
          ],
        ],
      ],
    ],
  ];
}