function MigrateUserRoleTest::assertEntity

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserRoleTest::assertEntity()
  2. 8.9.x core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserRoleTest::assertEntity()
  3. 10 core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserRoleTest::assertEntity()

Asserts aspects of a user role config entity.

@internal

Parameters

string $id: The role ID.

string $label: The role's expected label.

string[] $permissions: The expected permissions.

1 call to MigrateUserRoleTest::assertEntity()
MigrateUserRoleTest::testUserRole in core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php
Tests user role migration.

File

core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserRoleTest.php, line 39

Class

MigrateUserRoleTest
Upgrade user roles to user.role.*.yml.

Namespace

Drupal\Tests\user\Kernel\Migrate\d7

Code

protected function assertEntity(string $id, string $label, array $permissions) : void {
    
    /** @var \Drupal\user\RoleInterface $entity */
    $entity = Role::load($id);
    $this->assertInstanceOf(RoleInterface::class, $entity);
    $this->assertSame($label, $entity->label());
    $this->assertSame($permissions, $entity->getPermissions());
}

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