You are here

public function ViewModeTest::providerSource in Commerce Migrate 8.2

Same name in this branch
  1. 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc7/ViewModeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc7\ViewModeTest::providerSource()
  2. 8.2 modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ViewModeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ViewModeTest::providerSource()
  3. 8.2 modules/commerce/tests/src/Kernel/Plugin/migrate/source/commerce1/ViewModeTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Plugin\migrate\source\commerce1\ViewModeTest::providerSource()
Same name and namespace in other branches
  1. 3.1.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ViewModeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ViewModeTest::providerSource()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ViewModeTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6\ViewModeTest::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

modules/ubercart/tests/src/Kernel/Plugin/migrate/source/uc6/ViewModeTest.php, line 29

Class

ViewModeTest
Tests D6 Ubercart view mode source plugin.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Plugin\migrate\source\uc6

Code

public function providerSource() {
  $tests = [];

  // The source data.
  $tests[0]['source_data']['content_node_field_instance'] = [
    [
      'type_name' => 'node',
      'display_settings' => serialize([
        'weight' => '31',
        'parent' => '',
        'label' => [
          'format' => 'above',
        ],
        'teaser' => [
          'format' => 'default',
          'exclude' => 0,
        ],
        'full' => [
          'format' => 'default',
          'exclude' => 0,
        ],
        4 => [
          'format' => 'default',
          'exclude' => 0,
        ],
      ]),
    ],
    [
      'type_name' => 'product',
      'display_settings' => serialize([
        'weight' => '31',
        'parent' => '',
        'label' => [
          'format' => 'above',
        ],
        'teaser' => [
          'format' => 'default',
          'exclude' => 0,
        ],
        'full' => [
          'format' => 'default',
          'exclude' => 0,
        ],
        4 => [
          'format' => 'default',
          'exclude' => 0,
        ],
      ]),
    ],
  ];

  // The expected results.
  $tests[0]['expected_data'] = [
    [
      'entity_type' => 'node',
      'view_mode' => 4,
      'type_name' => 'node',
    ],
    [
      'entity_type' => 'node',
      'view_mode' => 'teaser',
      'type_name' => 'node',
    ],
    [
      'entity_type' => 'node',
      'view_mode' => 'full',
      'type_name' => 'node',
    ],
  ];
  return $tests;
}