You are here

protected function MigrateTestCase::retrievalAssertHelper in Drupal 8

Same name and namespace in other branches
  1. 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.

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 197

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
      ->assertArrayEquals($expected_value, $actual_value, $message);
  }
  else {
    $this
      ->assertSame((string) $expected_value, (string) $actual_value, $message);
  }
}