You are here

public function MediaViewModeTest::providerSource in Media Migration 8

The data provider.

Return value

array Array of data sets to test, each of which is a numerically indexed array with the following elements:

  • An array of source data, which can be optionally processed and set up by subclasses.
  • An array of expected result rows.
  • (optional) The number of result rows the plugin under test is expected to return. If this is not a numeric value, the plugin will not be counted.
  • (optional) Array of configuration options for the plugin under test.

Overrides MigrateSourceTestBase::providerSource

See also

\Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource

File

tests/src/Kernel/Plugin/migrate/source/d7/MediaViewModeTest.php, line 26

Class

MediaViewModeTest
Tests the d7_media_view_mode migration source plugin.

Namespace

Drupal\Tests\media_migration\Kernel\Plugin\migrate\source\d7

Code

public function providerSource() {
  $default_view_mode_rows = [
    [
      'mode' => 'full',
    ],
    [
      'mode' => 'preview',
    ],
    [
      'mode' => 'rss',
    ],
    [
      'mode' => 'teaser',
    ],
  ];
  return [
    'Defaults' => [
      'source_data' => [
        'system' => [
          [
            'name' => 'file_entity',
            'type' => 'module',
            'status' => 1,
          ],
        ],
      ],
      'expected_data' => $default_view_mode_rows,
    ],
    'Defaults + search' => [
      'source_data' => [
        'system' => [
          [
            'name' => 'file_entity',
            'type' => 'module',
            'status' => 1,
          ],
          [
            'name' => 'search',
            'type' => 'module',
            'status' => 1,
          ],
        ],
      ],
      'expected_data' => array_merge($default_view_mode_rows, [
        [
          'mode' => 'search_index',
        ],
        [
          'mode' => 'search_result',
        ],
      ]),
    ],
    'Defaults + media wysiwyg' => [
      'source_data' => [
        'system' => [
          [
            'name' => 'file_entity',
            'type' => 'module',
            'status' => 1,
          ],
          [
            'name' => 'media_wysiwyg',
            'type' => 'module',
            'status' => 1,
          ],
        ],
      ],
      'expected_data' => array_merge($default_view_mode_rows, [
        [
          'mode' => 'wysiwyg',
        ],
      ]),
    ],
    'Defaults + search + media wysiwyg' => [
      'source_data' => [
        'system' => [
          [
            'name' => 'file_entity',
            'type' => 'module',
            'status' => 1,
          ],
          [
            'name' => 'search',
            'type' => 'module',
            'status' => 1,
          ],
          [
            'name' => 'media_wysiwyg',
            'type' => 'module',
            'status' => 1,
          ],
        ],
      ],
      'expected_data' => array_merge($default_view_mode_rows, [
        [
          'mode' => 'search_index',
        ],
        [
          'mode' => 'search_result',
        ],
        [
          'mode' => 'wysiwyg',
        ],
      ]),
    ],
  ];
}