You are here

public function MigrateUrlAliasTestBase::testUrlAlias in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php \Drupal\Tests\path\Kernel\Migrate\d7\MigrateUrlAliasTestBase::testUrlAlias()

Test the URL alias migration.

File

core/modules/path/tests/src/Kernel/Migrate/d7/MigrateUrlAliasTestBase.php, line 51

Class

MigrateUrlAliasTestBase
Tests URL alias migration.

Namespace

Drupal\Tests\path\Kernel\Migrate\d7

Code

public function testUrlAlias() {
  $path_alias = $this
    ->loadPathAliasByConditions([
    'path' => '/taxonomy/term/4',
    'alias' => '/term33',
    'langcode' => 'und',
  ]);
  $this
    ->assertIdentical('/taxonomy/term/4', $path_alias
    ->getPath());
  $this
    ->assertIdentical('/term33', $path_alias
    ->getAlias());
  $this
    ->assertIdentical('und', $path_alias
    ->language()
    ->getId());

  // Alias with no slash.
  $path_alias = $this
    ->loadPathAliasByConditions([
    'alias' => '/source-noslash',
  ]);
  $this
    ->assertSame('/admin', $path_alias
    ->getPath());
  $this
    ->assertSame('und', $path_alias
    ->language()
    ->getId());
}