You are here

public function FieldInstancePerFormDisplayTest::providerSource in Drupal 8

Same name in this branch
  1. 8 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstancePerFormDisplayTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstancePerFormDisplayTest::providerSource()
  2. 8 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstancePerFormDisplayTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\FieldInstancePerFormDisplayTest::providerSource()
Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstancePerFormDisplayTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d6\FieldInstancePerFormDisplayTest::providerSource()

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

core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstancePerFormDisplayTest.php, line 23

Class

FieldInstancePerFormDisplayTest
Tests d6_field_instance_per_form_display source plugin.

Namespace

Drupal\Tests\field\Kernel\Plugin\migrate\source\d6

Code

public function providerSource() {
  $tests = [
    [
      'source_data' => [],
      'expected_data' => [],
    ],
  ];

  // The expected results.
  $tests[0]['expected_data'] = [
    [
      'display_settings' => [],
      'widget_settings' => [],
      'type_name' => 'story',
      'widget_active' => TRUE,
      'field_name' => 'field_test_filefield',
      'type' => 'filefield',
      'module' => 'filefield',
      'weight' => '8',
      'widget_type' => 'filefield_widget',
    ],
  ];

  // The source data.
  $empty_array = serialize([]);
  $tests[0]['source_data']['content_node_field'] = [
    [
      'field_name' => 'field_test_filefield',
      'type' => 'filefield',
      'global_settings' => $empty_array,
      'required' => '0',
      'multiple' => '0',
      'db_storage' => '1',
      'module' => 'filefield',
      'db_columns' => $empty_array,
      'active' => '1',
      'locked' => '0',
    ],
  ];
  $tests[0]['source_data']['content_node_field_instance'] = [
    [
      'field_name' => 'field_test_filefield',
      'type_name' => 'story',
      'weight' => '8',
      'label' => 'File Field',
      'widget_type' => 'filefield_widget',
      'widget_settings' => $empty_array,
      'display_settings' => $empty_array,
      'description' => 'An example image field.',
      'widget_module' => 'filefield',
      'widget_active' => '1',
    ],
  ];
  return $tests;
}