function MigrateUserRoleTest::assertMessages

Same name in other branches
  1. 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserRoleTest::assertMessages()

Assert the logged migrate messages.

Parameters

string[][] $role_data: An array of role data keyed by the destination role id. The role data contains the source role id, an array of valid permissions and an array of invalid permissions.

\Drupal\migrate\Plugin\MigrateIdMapInterface $id_map: The migration ID map plugin.

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

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserRoleTest.php, line 38

Class

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

Namespace

Drupal\Tests\user\Kernel\Migrate\d6

Code

public function assertMessages(array $role_data, MigrateIdMapInterface $id_map) : void {
    foreach ($id_map->getMessages() as $message) {
        $permissions = implode("', '", $role_data[$message->dest_id]['invalid']);
        $expected_message = "Permission(s) '" . $permissions . "' not found.";
        $this->assertSame($expected_message, $message->message);
        $this->assertSame(MigrationInterface::MESSAGE_WARNING, (int) $message->level);
    }
}

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