You are here

protected function SiteAlertTestTrait::assertAlertByLabel in Site Alert 8

Checks that the site alert with the given label contains the given data.

This assumes that the database only contains a single alert with the given label.

Parameters

string $label: The label of the site alert.

string $message: The expected message.

string $severity: The expected severity.

bool $active: The expected status.

array $scheduling: The expected start and end time, or an empty array if the site alert is not scheduled.

3 calls to SiteAlertTestTrait::assertAlertByLabel()
DrushCommandsTest::testCreateEndNoStart in tests/src/Functional/DrushCommandsTest.php
Tests site-alert:create with and end, but no start.
DrushCommandsTest::testCreateMinimalDelete in tests/src/Functional/DrushCommandsTest.php
Tests site-alert:create minimal.
DrushCommandsTest::testCreateStartNoEnd in tests/src/Functional/DrushCommandsTest.php
Tests site-alert:create with start, but no end.

File

tests/src/Traits/SiteAlertTestTrait.php, line 67

Class

SiteAlertTestTrait
Helper methods for testing the Site Alert module.

Namespace

Drupal\Tests\site_alert\Traits

Code

protected function assertAlertByLabel(string $label, string $message, string $severity = 'medium', bool $active = TRUE, array $scheduling = [
  'start' => '',
  'end' => '',
]) : void {
  $alert = $this
    ->loadAlertByLabel($label);
  $this
    ->assertAlert($alert, $label, $message, $severity, $active, $scheduling);
}