protected function SiteAlertTestTrait::getAlertCount in Site Alert 8
Returns the number of alerts with the given active status.
Parameters
bool $active: Whether to count active or inactive alerts.
Return value
int The number of alerts.
2 calls to SiteAlertTestTrait::getAlertCount()
- SiteAlertTestTrait::assertActiveAlertCount in tests/
src/ Traits/ SiteAlertTestTrait.php - Checks that the database contains the expected number of active alerts.
- SiteAlertTestTrait::assertInactiveAlertCount in tests/
src/ Traits/ SiteAlertTestTrait.php - Checks that the database contains the expected number of inactive alerts.
File
- tests/
src/ Traits/ SiteAlertTestTrait.php, line 114
Class
- SiteAlertTestTrait
- Helper methods for testing the Site Alert module.
Namespace
Drupal\Tests\site_alert\TraitsCode
protected function getAlertCount(bool $active) : int {
$query = $this->siteAlertStorage
->getQuery();
$query
->count()
->condition('active', $active);
return (int) $query
->execute();
}