function MigrateTestCase::queryResultTest

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

Tests a query.

Parameters

array|\Traversable $iter: The countable. foreach-able actual results if a query is being run.

array $expected_results: An array of expected results.

4 calls to MigrateTestCase::queryResultTest()
MigrateSqlIdMapTest::testGetRowsNeedingUpdate in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the getRowsNeedingUpdate method for rows that need an update.
MigrateSqlIdMapTest::testPrepareUpdate in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests prepareUpdate().
MigrateSqlIdMapTest::testSaveIdMapping in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests the ID mapping method.
MigrateSqlIdMapTest::testSetUpdate in core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
Tests setting a row source_row_status to STATUS_NEEDS_UPDATE.

File

core/modules/migrate/tests/src/Unit/MigrateTestCase.php, line 168

Class

MigrateTestCase
Provides setup and helper methods for Migrate module tests.

Namespace

Drupal\Tests\migrate\Unit

Code

public function queryResultTest($iter, $expected_results) {
    $this->assertSameSize($expected_results, $iter, 'Number of results match');
    $count = 0;
    foreach ($iter as $data_row) {
        $expected_row = $expected_results[$count];
        $count++;
        foreach ($expected_row as $key => $expected_value) {
            $this->retrievalAssertHelper($expected_value, $this->getValue($data_row, $key), sprintf('Value matches for key "%s"', $key));
        }
    }
    $this->assertSame(count($expected_results), $count);
}

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