You are here

protected function MigrateTestCase::retrievalAssertHelper in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/tests/src/Unit/MigrateTestCase.php \Drupal\Tests\migrate\Unit\MigrateTestCase::retrievalAssertHelper()
  2. 9 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.

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);
  }
}