3 namespace Drupal\Tests\redirect\Kernel\Migrate\d6;
5 use Drupal\redirect\Entity\Redirect;
6 use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
10 * Tests the d6_path_redirect source plugin.
14 class PathRedirectTest extends MigrateDrupalTestBase {
19 public static $modules = array('redirect', 'link');
24 protected function setUp() {
26 $this->installSchema('system', array('router'));
27 $this->installEntitySchema('redirect');
28 $this->loadFixture( __DIR__ . '/../../../../../tests/fixtures/drupal6.php');
30 $this->executeMigrations(['d6_path_redirect']);
34 * Tests the Drupal 6 path redirect to Drupal 8 migration.
36 public function testPathRedirect() {
38 /** @var Redirect $redirect */
39 $redirect = Redirect::load(5);
40 $this->assertSame($this->getMigration('d6_path_redirect')
42 ->lookupDestinationID(array(5)), array($redirect->id()));
43 $this->assertSame("/test/source/url", $redirect->getSourceUrl());
44 $this->assertSame("base:test/redirect/url", $redirect->getRedirectUrl()->toUriString());
46 $redirect = Redirect::load(7);
47 $this->assertSame("/test/source/url2", $redirect->getSourceUrl());
48 $this->assertSame("http://test/external/redirect/url?foo=bar&biz=buz", $redirect->getRedirectUrl()->toUriString());