You are here

protected function ValidationResultTest::assertResultValid in Automatic Updates 8.2

Asserts a check result is valid.

Parameters

\Drupal\automatic_updates\Validation\ValidationResult $result: The validation result to check.

array $expected_messages: The expected messages.

\Drupal\Core\StringTranslation\TranslatableMarkup|null $summary: The expected summary or NULL if not summary is expected.

int $severity: The severity.

2 calls to ValidationResultTest::assertResultValid()
ValidationResultTest::testCreateErrorResult in tests/src/Unit/ValidationResultTest.php
@covers ::createError
ValidationResultTest::testCreateWarningResult in tests/src/Unit/ValidationResultTest.php
@covers ::createWarning

File

tests/src/Unit/ValidationResultTest.php, line 88

Class

ValidationResultTest
@coversDefaultClass \Drupal\automatic_updates\Validation\ValidationResult

Namespace

Drupal\Tests\automatic_updates\Unit

Code

protected function assertResultValid(ValidationResult $result, array $expected_messages, ?TranslatableMarkup $summary, int $severity) : void {
  $this
    ->assertSame($expected_messages, $result
    ->getMessages());
  if ($summary === NULL) {
    $this
      ->assertNull($result
      ->getSummary());
  }
  else {
    $this
      ->assertSame($summary
      ->getUntranslatedString(), $result
      ->getSummary()
      ->getUntranslatedString());
  }
  $this
    ->assertSame($severity, $result
    ->getSeverity());
}