function MigrateTestCase::retrievalAssertHelper

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

Asserts tested values during test retrieval.

Parameters

mixed $expected_value: The incoming expected value to test.

mixed $actual_value: The incoming value itself.

string $message: The tested result as a formatted string.

1 call to MigrateTestCase::retrievalAssertHelper()
MigrateTestCase::queryResultTest in core/modules/migrate/tests/src/Unit/MigrateTestCase.php
Tests a query.

File

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

Class

MigrateTestCase
Provides setup and helper methods for Migrate module tests.

Namespace

Drupal\Tests\migrate\Unit

Code

protected function retrievalAssertHelper($expected_value, $actual_value, $message) {
    if (is_array($expected_value)) {
        // If the expected and actual values are empty, no need to array compare.
        if (empty($expected_value && $actual_value)) {
            return;
        }
        $this->assertEquals($expected_value, $actual_value, $message);
    }
    else {
        $this->assertSame((string) $expected_value, (string) $actual_value, $message);
    }
}

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