function MigrateShortcutSetTest::assertEntity

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

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
Test 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($id, $label, $expected_size) {
    $shortcut_set = ShortcutSet::load($id);
    $this->assertInstanceOf(ShortcutSetInterface::class, $shortcut_set);
    
    /** @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);
}

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