You are here

protected function PathRedirectTest::assertEntity in Redirect 8

Asserts various aspects of a redirect entity.

Parameters

int $id: The entity ID in the form ENTITY_TYPE.BUNDLE.FIELD_NAME.

string $source_url: The expected source url.

string $redirect_url: The expected redirect url.

string $status_code: The expected status code.

1 call to PathRedirectTest::assertEntity()
PathRedirectTest::testPathRedirect in tests/src/Kernel/Migrate/d7/PathRedirectTest.php
Tests the Drupal 7 path redirect to Drupal 8 migration.

File

tests/src/Kernel/Migrate/d7/PathRedirectTest.php, line 49
Contains \Drupal\Tests\redirect\Kernel\Migrate\d7\PathRedirectTest.

Class

PathRedirectTest
Tests the d7_path_redirect source plugin.

Namespace

Drupal\Tests\redirect\Kernel\Migrate\d7

Code

protected function assertEntity($id, $source_url, $redirect_url, $status_code) {

  /** @var Redirect $redirect */
  $redirect = Redirect::load($id);
  $this
    ->assertSame($this
    ->getMigration('d7_path_redirect')
    ->getIdMap()
    ->lookupDestinationIds([
    $id,
  ]), [
    [
      $redirect
        ->id(),
    ],
  ]);
  $this
    ->assertSame($source_url, $redirect
    ->getSourceUrl());
  $this
    ->assertSame($redirect_url, $redirect
    ->getRedirectUrl()
    ->toUriString());
  $this
    ->assertSame($status_code, $redirect
    ->getStatusCode());
}