function MigrateMessageFormTest::getMessages

Same name in other branches
  1. 10 core/modules/migrate/tests/src/Functional/MigrateMessageFormTest.php \Drupal\Tests\migrate\Functional\MigrateMessageFormTest::getMessages()

Gets the migrate messages.

Return value

array[] List of log events where each event is an array with following keys:

  • msg_id: (string) A message id.
  • severity: (int) The MigrationInterface error level.
  • message: (string) The migration message.
2 calls to MigrateMessageFormTest::getMessages()
MigrateMessageFormTest::getLevelCounts in core/modules/migrate/tests/src/Functional/MigrateMessageFormTest.php
Gets the count of migration messages by level.
MigrateMessageFormTest::testFilter in core/modules/migrate/tests/src/Functional/MigrateMessageFormTest.php
Tests the message form.

File

core/modules/migrate/tests/src/Functional/MigrateMessageFormTest.php, line 83

Class

MigrateMessageFormTest
Tests for the MessageForm class.

Namespace

Drupal\Tests\migrate\Functional

Code

protected function getMessages() : array {
    $levels = [
        'Error' => MigrationInterface::MESSAGE_ERROR,
        'Warning' => MigrationInterface::MESSAGE_WARNING,
        'Notice' => MigrationInterface::MESSAGE_NOTICE,
        'Info' => MigrationInterface::MESSAGE_INFORMATIONAL,
    ];
    $entries = [];
    $table = $this->xpath('.//table[@id="admin-migrate-msg"]/tbody/tr');
    foreach ($table as $row) {
        $cells = $row->findAll('css', 'td');
        if (count($cells) === 3) {
            $entries[] = [
                'msg_id' => $cells[0]->getText(),
                'severity' => $levels[$cells[1]->getText()],
                'message' => $cells[2]->getText(),
            ];
        }
    }
    return $entries;
}

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