You are here

protected function SiteAlertTestTrait::assertAlertCount in Site Alert 8

Checks that the database contains the expected number of alerts.

Parameters

int $expected_count: The expected number of alerts.

5 calls to SiteAlertTestTrait::assertAlertCount()
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.
DrushCommandsTest::testDisableAll in tests/src/Functional/DrushCommandsTest.php
Tests site-alert:disable --all.
DrushCommandsTest::testDisableWithLabel in tests/src/Functional/DrushCommandsTest.php
Tests site-alert:disable [label].

File

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

Class

SiteAlertTestTrait
Helper methods for testing the Site Alert module.

Namespace

Drupal\Tests\site_alert\Traits

Code

protected function assertAlertCount(int $expected_count) : void {
  $query = $this->siteAlertStorage
    ->getQuery();
  $query
    ->count();
  $actual_count = (int) $query
    ->execute();
  $this
    ->assertEquals($expected_count, $actual_count);
}