function ValidationResultTest::assertResultValid

Asserts a check result is valid.

Parameters

\Drupal\package_manager\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 core/modules/package_manager/tests/src/Unit/ValidationResultTest.php
@covers ::createError
ValidationResultTest::testCreateWarningResult in core/modules/package_manager/tests/src/Unit/ValidationResultTest.php
@covers ::createWarning

File

core/modules/package_manager/tests/src/Unit/ValidationResultTest.php, line 163

Class

ValidationResultTest
@coversDefaultClass \Drupal\package_manager\ValidationResult @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

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

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