You are here

public function TermSourceWithVocabularyFilterTest::providerSource in Drupal 9

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

See also

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

File

core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/TermSourceWithVocabularyFilterTest.php, line 21

Class

TermSourceWithVocabularyFilterTest
Tests the taxonomy term source with vocabulary filter.

Namespace

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

Code

public function providerSource() {

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

  // The expected results.
  $tests[0]['expected_data'] = [
    [
      'tid' => 1,
      'vid' => 5,
      'name' => 'name value 1',
      'description' => 'description value 1',
      'weight' => 0,
      'parent' => [
        0,
      ],
    ],
    [
      'tid' => 4,
      'vid' => 5,
      'name' => 'name value 4',
      'description' => 'description value 4',
      'weight' => 1,
      'parent' => [
        1,
      ],
    ],
  ];

  // We know there are two rows with vid == 5.
  $tests[0]['expected_count'] = 2;

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