You are here

public function MediaWysiwygPluginBaseTest::providerTestPluginConstruct in Media Migration 8

Data provider for ::testPluginConstruct.

Return value

array The test cases.

File

tests/src/Unit/MediaWysiwygPluginBaseTest.php, line 84

Class

MediaWysiwygPluginBaseTest
Tests the Bean Media WYSIWYG plugin.

Namespace

Drupal\Tests\media_migration\Unit

Code

public function providerTestPluginConstruct() {
  return [
    'Explicit source config, multiple map item' => [
      'Config' => [
        'source_entity_type_id' => 'source_id_2',
      ],
      'Definition' => [
        'entity_type_map' => [
          'source_id' => 'dest_id',
          'source_id_2' => 'dest_id',
          'source_id_3' => 'dest_id_2',
        ],
      ],
      'Exception' => NULL,
    ],
    'Explicit but invalid config, multiple map item' => [
      'Config' => [
        'source_entity_type_id' => 'unmapped_source_id',
      ],
      'Definition' => [
        'entity_type_map' => [
          'source_id' => 'dest_id',
          'source_id_2' => 'dest_id',
          'source_id_3' => 'dest_id_2',
        ],
      ],
      'Exception' => "/^The MediaWysiwyg plugin instance of class '.*MediaWysiwygPluginBase.*' cannot be instantiated with the following configuration: array(.*)\$/s",
    ],
    'Undefined map' => [
      'Config' => [
        'source_entity_type_id' => 'source_id',
      ],
      'Definition' => [],
      'Exception' => "/^The MediaWysiwyg plugin instance of class '.*MediaWysiwygPluginBase.*' cannot be instantiated with the following configuration: array(.*)\$/s",
    ],
    'Empty map' => [
      'Config' => [
        'source_entity_type_id' => 'source_id',
      ],
      'Definition' => [
        'entity_type_map' => [],
      ],
      'Exception' => "/^The MediaWysiwyg plugin instance of class '.*MediaWysiwygPluginBase.*' cannot be instantiated with the following configuration: array(.*)\$/s",
    ],
    'Empty config, one map item' => [
      'Config' => [],
      'Definition' => [
        'entity_type_map' => [
          'source_id' => 'dest_id',
        ],
      ],
      'Exception' => NULL,
    ],
    'Empty config, multiple map item' => [
      'Config' => [],
      'Definition' => [
        'entity_type_map' => [
          'source_id' => 'dest_id',
          'source_id_2' => 'dest_id',
          'source_id_3' => 'dest_id_2',
        ],
      ],
      'Exception' => "/^The MediaWysiwyg plugin instance of class '.*MediaWysiwygPluginBase.*' cannot be instantiated with the following configuration: array(.*)\$/s",
    ],
  ];
}