You are here

protected function ValidationTestTrait::assertValidationResultsEqual in Automatic Updates 8.2

Asserts two validation result sets are equal.

Parameters

\Drupal\automatic_updates\Validation\ValidationResult[] $expected_results: The expected validation results.

\Drupal\automatic_updates\Validation\ValidationResult[]|null $actual_results: The actual validation results or NULL if known are available.

1 call to ValidationTestTrait::assertValidationResultsEqual()
ValidationTestTrait::assertCheckerResultsFromManager in tests/src/Traits/ValidationTestTrait.php
Asserts expected validation results from the manager.

File

tests/src/Traits/ValidationTestTrait.php, line 99

Class

ValidationTestTrait
Common methods for testing validation.

Namespace

Drupal\Tests\automatic_updates\Traits

Code

protected function assertValidationResultsEqual(array $expected_results, array $actual_results) : void {
  $this
    ->assertCount(count($expected_results), $actual_results);
  foreach ($expected_results as $expected_result) {
    $actual_result = array_shift($actual_results);
    $this
      ->assertSame($expected_result
      ->getSeverity(), $actual_result
      ->getSeverity());
    $this
      ->assertSame((string) $expected_result
      ->getSummary(), (string) $actual_result
      ->getSummary());
    $this
      ->assertSame(array_map('strval', $expected_result
      ->getMessages()), array_map('strval', $actual_result
      ->getMessages()));
  }
}