You are here

protected function MigrateShortcutSetTest::assertEntity in Drupal 10

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

Asserts various aspects of a shortcut set entity.

@internal

Parameters

string $id: The expected shortcut set ID.

string $label: The expected shortcut set label.

int $expected_size: The number of shortcuts expected to be in the set.

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

File

core/modules/shortcut/tests/src/Kernel/Migrate/d7/MigrateShortcutSetTest.php, line 60

Class

MigrateShortcutSetTest
Test shortcut_set migration to ShortcutSet entities.

Namespace

Drupal\Tests\shortcut\Kernel\Migrate\d7

Code

protected function assertEntity(string $id, string $label, int $expected_size) : void {
  $shortcut_set = ShortcutSet::load($id);
  $this
    ->assertInstanceOf(ShortcutSetInterface::class, $shortcut_set);

  /** @var \Drupal\shortcut\ShortcutSetInterface $shortcut_set */
  $this
    ->assertSame($id, $shortcut_set
    ->id());
  $this
    ->assertSame($label, $shortcut_set
    ->label());

  // Check the number of shortcuts in the set.
  $shortcuts = $shortcut_set
    ->getShortcuts();
  $this
    ->assertCount($expected_size, $shortcuts);
}