function MigrateShortcutTest::assertEntity

Same name in other branches
  1. 9 core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutTest::assertEntity()
  2. 10 core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutTest.php \Drupal\Tests\shortcut\Kernel\Migrate\d7\MigrateShortcutTest::assertEntity()
  3. 11.x 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.

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
Test 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($id, $title, $weight, $url) {
    $shortcut = Shortcut::load($id);
    $this->assertInstanceOf(ShortcutInterface::class, $shortcut);
    
    /** @var \Drupal\shortcut\ShortcutInterface $shortcut */
    $this->assertIdentical($title, $shortcut->getTitle());
    $this->assertIdentical($weight, $shortcut->getWeight());
    $this->assertIdentical($url, $shortcut->getUrl()
        ->toString());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.