You are here

public function VocabularyTest::providerSource in Drupal 9

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

1 call to VocabularyTest::providerSource()
LanguageContentTaxonomyVocabularySettingsTest::providerSource in core/modules/language/tests/src/Kernel/Plugin/migrate/source/d7/LanguageContentTaxonomyVocabularySettingsTest.php
The data provider.
1 method overrides VocabularyTest::providerSource()
LanguageContentTaxonomyVocabularySettingsTest::providerSource in core/modules/language/tests/src/Kernel/Plugin/migrate/source/d7/LanguageContentTaxonomyVocabularySettingsTest.php
The data provider.

File

core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTest.php, line 23

Class

VocabularyTest
Tests D7 vocabulary source plugin.

Namespace

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

Code

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

  // The source data.
  $tests[0]['source_data']['taxonomy_vocabulary'] = [
    [
      'vid' => 1,
      'name' => 'Tags',
      'description' => 'Tags description.',
      'hierarchy' => 0,
      'module' => 'taxonomy',
      'weight' => 0,
      'machine_name' => 'tags',
    ],
    [
      'vid' => 2,
      'name' => 'Categories',
      'description' => 'Categories description.',
      'hierarchy' => 1,
      'module' => 'taxonomy',
      'weight' => 0,
      'machine_name' => 'categories',
    ],
  ];

  // The expected results.
  $tests[0]['expected_data'] = $tests[0]['source_data']['taxonomy_vocabulary'];
  return $tests;
}