You are here

protected function MigrateShortcutTest::assertEntity in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutTest::assertEntity()
  2. 9 core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutTest::assertEntity()

Asserts various aspects of a shortcut entity.

@internal

Parameters

int $id: The shortcut ID.

string $title: The expected title of the shortcut.

int $weight: The expected weight of the shortcut.

string $url: The expected URL of the shortcut.

1 call to MigrateShortcutTest::assertEntity()
MigrateShortcutTest::testShortcutMigration in core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php
Tests the shortcut migration.

File

core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php, line 54

Class

MigrateShortcutTest
Test shortcut menu links migration to Shortcut entities.

Namespace

Drupal\Tests\shortcut\Kernel\Migrate\d7

Code

protected function assertEntity(int $id, string $title, int $weight, string $url) : void {
  $shortcut = Shortcut::load($id);
  $this
    ->assertInstanceOf(ShortcutInterface::class, $shortcut);

  /** @var \Drupal\shortcut\ShortcutInterface $shortcut */
  $this
    ->assertSame($title, $shortcut
    ->getTitle());
  $this
    ->assertSame($weight, (int) $shortcut
    ->getWeight());
  $this
    ->assertSame($url, $shortcut
    ->getUrl()
    ->toString());
}