You are here

public function CliCommandsTest::testCreateSiteAlert in Site Alert 8

Test site alert creation with message and severity.

@covers ::create

File

tests/src/Kernel/CliCommandsTest.php, line 48

Class

CliCommandsTest
Tests for the site alert CLI Commands service.

Namespace

Drupal\Tests\site_alert\Kernel

Code

public function testCreateSiteAlert() : void {

  // Create a simple alert with a message, and a severity.
  $label = 'phpunit_test_create';
  $message = "A nice bit of message here.";
  $severity = 'low';
  $options = [
    'severity' => $severity,
  ];
  $this->cliCommands
    ->create($label, $message, $options);

  // Check that the created alert contains the expected data.
  $site_alert = $this
    ->loadAlertByLabel($label);
  $this
    ->assertAlert($site_alert, $label, $message, $severity, TRUE);
}