function MigrateSqlSourceTestBase::testSource

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase::testSource()
  2. 10 core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase::testSource()
  3. 11.x core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php \Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase::testSource()

Tests the source plugin against a particular data set.

@dataProvider providerSource

@requires extension pdo_sqlite

Parameters

array $source_data: The source data that the plugin will read. See getDatabase() for the expected format.

array $expected_data: The result rows the plugin is expected to return.

int $expected_count: (optional) How many rows the source plugin is expected to return.

array $configuration: (optional) Configuration for the source plugin.

mixed $high_water: (optional) The value of the high water field.

Overrides MigrateSourceTestBase::testSource

4 calls to MigrateSqlSourceTestBase::testSource()
CommentTypeTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d7/CommentTypeTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d7\NodeType instead.
CommentVariablePerCommentTypeTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d6/CommentVariablePerCommentTypeTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentVariablePerCommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType…
CommentVariableTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d6/CommentVariableTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentVariable is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.
i18nVariableTest::testSource in core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d6/i18nVariableTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation The Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use…
4 methods override MigrateSqlSourceTestBase::testSource()
CommentTypeTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d7/CommentTypeTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d7\NodeType instead.
CommentVariablePerCommentTypeTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d6/CommentVariablePerCommentTypeTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentVariablePerCommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType…
CommentVariableTest::testSource in core/modules/comment/tests/src/Kernel/Plugin/migrate/source/d6/CommentVariableTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation CommentVariable is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.
i18nVariableTest::testSource in core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d6/i18nVariableTest.php
@dataProvider providerSource @requires extension pdo_sqlite @expectedDeprecation The Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use…

File

core/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php, line 75

Class

MigrateSqlSourceTestBase
Base class for tests of Migrate source plugins that use a database.

Namespace

Drupal\Tests\migrate\Kernel

Code

public function testSource(array $source_data, array $expected_data, $expected_count = NULL, array $configuration = [], $high_water = NULL) {
    $plugin = $this->getPlugin($configuration);
    // Since we don't yet inject the database connection, we need to use a
    // reflection hack to set it in the plugin instance.
    $reflector = new \ReflectionObject($plugin);
    $property = $reflector->getProperty('database');
    $property->setAccessible(TRUE);
    $property->setValue($plugin, $this->getDatabase($source_data));
    parent::testSource($source_data, $expected_data, $expected_count, $configuration, $high_water);
}

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