diff --git a/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d6/UrlAliasTest.php b/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d6/UrlAliasTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1057dffbee66a725e646f647de54d5f4c572c285 --- /dev/null +++ b/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d6/UrlAliasTest.php @@ -0,0 +1,48 @@ +<?php + +namespace Drupal\Tests\path\Kernel\Plugin\migrate\source\d6; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests the d6_url_alias source plugin. + * + * @covers \Drupal\path\Plugin\migrate\source\d6\UrlAlias + * @group path + */ +class UrlAliasTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['migrate_drupal', 'path']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['url_alias'] = [ + [ + 'pid' => 1, + 'src' => 'node/1', + 'dst' => 'test-article', + 'language' => 'en', + ], + [ + 'pid' => 2, + 'src' => 'node/2', + 'dst' => 'another-alias', + 'language' => 'en', + ], + ]; + + // The expected results. + $tests[0]['expected_data'] = $tests[0]['source_data']['url_alias']; + + return $tests; + } + +} diff --git a/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d7/UrlAliasTest.php b/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d7/UrlAliasTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2fdfd361d66c2e101ef4715a695796dadffd278e --- /dev/null +++ b/core/modules/path/tests/src/Kernel/Plugin/migrate/source/d7/UrlAliasTest.php @@ -0,0 +1,48 @@ +<?php + +namespace Drupal\Tests\path\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests the d7_url_alias source plugin. + * + * @covers \Drupal\path\Plugin\migrate\source\d7\UrlAlias + * @group path + */ +class UrlAliasTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['migrate_drupal', 'path']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['url_alias'] = [ + [ + 'pid' => 1, + 'source' => 'node/1', + 'alias' => 'test-article', + 'language' => 'en', + ], + [ + 'pid' => 2, + 'source' => 'node/2', + 'alias' => 'another-alias', + 'language' => 'en', + ], + ]; + + // The expected results. + $tests[0]['expected_data'] = $tests[0]['source_data']['url_alias']; + + return $tests; + } + +} diff --git a/core/modules/path/tests/src/Unit/Migrate/UrlAliasTestBase.php b/core/modules/path/tests/src/Unit/Migrate/UrlAliasTestBase.php deleted file mode 100644 index c929192cbd221075940318e3c3841dc8c067dbba..0000000000000000000000000000000000000000 --- a/core/modules/path/tests/src/Unit/Migrate/UrlAliasTestBase.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -namespace Drupal\Tests\path\Unit\Migrate; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Base class for url_alias source tests. - */ -abstract class UrlAliasTestBase extends MigrateSqlSourceTestCase { - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['url_alias'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/path/tests/src/Unit/Migrate/d6/UrlAliasTest.php b/core/modules/path/tests/src/Unit/Migrate/d6/UrlAliasTest.php deleted file mode 100644 index fa00d60c9825fd0d3116d81218f8267ae4c7ab11..0000000000000000000000000000000000000000 --- a/core/modules/path/tests/src/Unit/Migrate/d6/UrlAliasTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\Tests\path\Unit\Migrate\d6; - -use Drupal\Tests\path\Unit\Migrate\UrlAliasTestBase; - -/** - * Tests the d6_url_alias source plugin. - * - * @group path - */ -class UrlAliasTest extends UrlAliasTestBase { - - const PLUGIN_CLASS = 'Drupal\path\Plugin\migrate\source\d6\UrlAlias'; - - protected $migrationConfiguration = array( - 'id' => 'test', - 'source' => array( - 'plugin' => 'd6_url_alias', - ), - ); - - protected $expectedResults = array( - array( - 'pid' => 1, - 'src' => 'node/1', - 'dst' => 'test-article', - 'language' => 'en', - ), - array( - 'pid' => 2, - 'src' => 'node/2', - 'dst' => 'another-alias', - 'language' => 'en', - ), - ); - -} diff --git a/core/modules/path/tests/src/Unit/Migrate/d7/UrlAliasTest.php b/core/modules/path/tests/src/Unit/Migrate/d7/UrlAliasTest.php deleted file mode 100644 index d2fce564d6dfe5974f16fd008f206371689e911c..0000000000000000000000000000000000000000 --- a/core/modules/path/tests/src/Unit/Migrate/d7/UrlAliasTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\Tests\path\Unit\Migrate\d7; - -use Drupal\Tests\path\Unit\Migrate\UrlAliasTestBase; - -/** - * Tests the d7_url_alias source plugin. - * - * @group path - */ -class UrlAliasTest extends UrlAliasTestBase { - - const PLUGIN_CLASS = 'Drupal\path\Plugin\migrate\source\d7\UrlAlias'; - - protected $migrationConfiguration = array( - 'id' => 'test', - 'source' => array( - 'plugin' => 'd7_url_alias', - ), - ); - - protected $expectedResults = array( - array( - 'pid' => 1, - 'source' => 'node/1', - 'alias' => 'test-article', - 'language' => 'en', - ), - array( - 'pid' => 2, - 'source' => 'node/2', - 'alias' => 'another-alias', - 'language' => 'en', - ), - ); - -}