function ViewModeTest::providerSource

Same name in this branch
  1. 9 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/ViewModeTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\ViewModeTest::providerSource()
Same name and namespace in other branches
  1. 8.9.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/ViewModeTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\ViewModeTest::providerSource()
  2. 8.9.x core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\ViewModeTest::providerSource()
  3. 10 core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/ViewModeTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\ViewModeTest::providerSource()
  4. 10 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\ViewModeTest::providerSource()
  5. 11.x core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/ViewModeTest.php \Drupal\Tests\field\Kernel\Plugin\migrate\source\d7\ViewModeTest::providerSource()
  6. 11.x core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\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

File

core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/ViewModeTest.php, line 24

Class

ViewModeTest
Tests D6 view mode source plugin.

Namespace

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

Code

public function providerSource() {
    $tests = [];
    // The source data.
    $tests[0]['source_data']['content_node_field_instance'] = [
        [
            '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',
        ],
        [
            'entity_type' => 'node',
            'view_mode' => 'teaser',
        ],
        [
            'entity_type' => 'node',
            'view_mode' => 'full',
        ],
    ];
    return $tests;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.