You are here

protected function UserRoleTest::assertRoleCount in Feeds 8.3

Asserts the expected number of roles an user has.

This excludes the authenticated user role.

Parameters

int $expected_number_of_roles: The expected number of roles.

\Drupal\user\UserInterface $account: The account to check for the role count.

string $message: (optional) Assertion message.

7 calls to UserRoleTest::assertRoleCount()
UserRoleTest::testImportByRoleLabels in tests/src/Kernel/Feeds/Target/UserRoleTest.php
Tests mapping to role by role label.
UserRoleTest::testNoRevokeRoles in tests/src/Kernel/Feeds/Target/UserRoleTest.php
Tests if no roles are revoked if the option "Revoke roles" is disabled.
UserRoleTest::testRevokeRoles in tests/src/Kernel/Feeds/Target/UserRoleTest.php
Tests that roles can be revoked and that only allowed roles are revoked.
UserRoleTest::testRoleCreationUsingLabel in tests/src/Kernel/Feeds/Target/UserRoleTest.php
Tests automatically creating new roles based on label.
UserRoleTest::testWithAllowedRoles in tests/src/Kernel/Feeds/Target/UserRoleTest.php
Tests mapping to role using only allowed roles.

... See full list

File

tests/src/Kernel/Feeds/Target/UserRoleTest.php, line 124

Class

UserRoleTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\UserRole @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

protected function assertRoleCount($expected_number_of_roles, UserInterface $account, $message = '') {
  $this
    ->assertEquals($expected_number_of_roles, count($account
    ->getRoles(TRUE)), $message);
}