You are here

public function NodeTranslationTest::providerSource in Drupal 8

Same name in this branch
  1. 8 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d6/NodeTranslationTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d6\NodeTranslationTest::providerSource()
  2. 8 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d7\NodeTranslationTest::providerSource()
Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php \Drupal\Tests\node\Kernel\Plugin\migrate\source\d7\NodeTranslationTest::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 NodeTest::providerSource

See also

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

File

core/modules/node/tests/src/Kernel/Plugin/migrate/source/d7/NodeTranslationTest.php, line 22

Class

NodeTranslationTest
Tests D7 node translation source plugin.

Namespace

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

Code

public function providerSource() {

  // Get the source data from parent.
  $tests = parent::providerSource();

  // The expected results.
  $tests[0]['expected_data'] = [
    [
      // Node fields.
      'nid' => 7,
      'vid' => 7,
      'type' => 'article',
      'language' => 'fr',
      'title' => 'node title 5 (title_field)',
      'node_uid' => 1,
      'revision_uid' => 1,
      'status' => 1,
      'created' => 1279292908,
      'changed' => 1279310993,
      'comment' => 0,
      'promote' => 1,
      'sticky' => 0,
      'tnid' => 6,
      'translate' => 0,
      // Node revision fields.
      'log' => '',
      'timestamp' => 1279310993,
      'body' => [
        [
          'value' => 'fr - body 6',
          'summary' => '',
          'format' => 'filtered_html',
        ],
      ],
    ],
  ];

  // Do an automatic count.
  $tests[0]['expected_count'] = NULL;

  // Set up source plugin configuration.
  $tests[0]['configuration'] = [
    'translations' => TRUE,
  ];
  return $tests;
}