function MigrateSqlIdMapTest::testMessageCount

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMessageCount()
  2. 8.9.x core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMessageCount()
  3. 10 core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php \Drupal\Tests\migrate\Unit\MigrateSqlIdMapTest::testMessageCount()

Tests the SQL ID map message count method by counting and saving messages.

File

core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php, line 284

Class

MigrateSqlIdMapTest
Tests the SQL ID map plugin.

Namespace

Drupal\Tests\migrate\Unit

Code

public function testMessageCount() : void {
    $message = 'Hello world.';
    $expected_results = [
        0,
        1,
        2,
        3,
    ];
    $id_map = $this->getIdMap();
    // Test count message multiple times starting from 0.
    foreach ($expected_results as $key => $expected_result) {
        $count = $id_map->messageCount();
        $this->assertSame($expected_result, $count);
        $id_map->saveMessage([
            'source_id_property' => $key,
        ], $message);
    }
}

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