You are here

public function PathRedirectTest::testPathRedirect in Redirect 8

Same name in this branch
  1. 8 tests/src/Kernel/Migrate/d6/PathRedirectTest.php \Drupal\Tests\redirect\Kernel\Migrate\d6\PathRedirectTest::testPathRedirect()
  2. 8 tests/src/Kernel/Migrate/d7/PathRedirectTest.php \Drupal\Tests\redirect\Kernel\Migrate\d7\PathRedirectTest::testPathRedirect()

Tests the Drupal 6 path redirect to Drupal 8 migration.

File

tests/src/Kernel/Migrate/d6/PathRedirectTest.php, line 35

Class

PathRedirectTest
Tests the d6_path_redirect source plugin.

Namespace

Drupal\Tests\redirect\Kernel\Migrate\d6

Code

public function testPathRedirect() {

  /** @var Redirect $redirect */
  $redirect = Redirect::load(5);
  $this
    ->assertSame($this
    ->getMigration('d6_path_redirect')
    ->getIdMap()
    ->lookupDestinationIds([
    5,
  ]), [
    [
      $redirect
        ->id(),
    ],
  ]);
  $this
    ->assertSame("/test/source/url", $redirect
    ->getSourceUrl());
  $this
    ->assertSame("base:test/redirect/url", $redirect
    ->getRedirectUrl()
    ->toUriString());
  $redirect = Redirect::load(7);
  $this
    ->assertSame("/test/source/url2", $redirect
    ->getSourceUrl());
  $this
    ->assertSame("http://test/external/redirect/url?foo=bar&biz=buz", $redirect
    ->getRedirectUrl()
    ->toUriString());
}