You are here

protected function MigrateShortcutSetTest::assertEntity in Zircon Profile 8

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

Asserts various aspects of a shortcut set entity.

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/src/Tests/Migrate/d7/MigrateShortcutSetTest.php
Test the shortcut set migration.

File

core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php, line 65
Contains \Drupal\shortcut\Tests\Migrate\d7\MigrateShortcutSetTest.

Class

MigrateShortcutSetTest
Test shortcut_set migration to ShortcutSet entities.

Namespace

Drupal\shortcut\Tests\Migrate\d7

Code

protected function assertEntity($id, $label, $expected_size) {
  $shortcut_set = ShortcutSet::load($id);
  $this
    ->assertTrue($shortcut_set instanceof ShortcutSetInterface);

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

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