From fb9591f0ccf971b6bb07edf3262556faf26eb414 Mon Sep 17 00:00:00 2001 From: catch Date: Mon, 1 Apr 2024 08:28:38 +0100 Subject: [PATCH] Issue #3437129 by mikelutz: Remove Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::providerSource() --- core/.phpstan-baseline.php | 10 +++++ .../src/Kernel/MigrateSourceTestBase.php | 41 +++++++++++-------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 789b1e63b59..e6850a6c665 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -1131,6 +1131,16 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/migrate/src/Plugin/migrate/destination/NullDestination.php', ]; +$ignoreErrors[] = [ + 'message' => '#^@dataProvider providerSource related method not found\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php', +]; +$ignoreErrors[] = [ + 'message' => '#^@dataProvider providerSource related method not found\\.$#', + 'count' => 1, + 'path' => __DIR__ . '/modules/migrate/tests/src/Kernel/MigrateSqlSourceTestBase.php', +]; $ignoreErrors[] = [ 'message' => '#^Call to an undefined static method Drupal\\\\Tests\\\\migrate\\\\Kernel\\\\MigrateTestBase\\:\\:migrateDumpAlter\\(\\)\\.$#', 'count' => 1, diff --git a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php index f102b4b4112..ba3317ba2aa 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateSourceTestBase.php @@ -9,6 +9,29 @@ use Drupal\migrate\Row; /** * Base class for tests of Migrate source plugins. + * + * Implementing classes must declare a providerSource() method for this class + * to work, defined as follows: + * + * @code + * abstract public static function providerSource(): array; + * @endcode + * + * The returned array should be as follows: + * + * @code + * 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. + * @endcode + * + * @see \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource */ abstract class MigrateSourceTestBase extends KernelTestBase { @@ -31,24 +54,6 @@ abstract class MigrateSourceTestBase extends KernelTestBase { */ protected $plugin; - /** - * The data provider. - * - * @see \Drupal\Tests\migrate\Kernel\MigrateSourceTestBase::testSource - * - * @return 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. - */ - abstract public static function providerSource(); - /** * {@inheritdoc} */