You are here

protected function SiteAlertTestTrait::loadAlertsByLabel in Site Alert 8

Returns all site alerts with a matching label.

Parameters

string $label: The label to search for.

Return value

array Array of site alerts found.

2 calls to SiteAlertTestTrait::loadAlertsByLabel()
CliCommandsTest::testDeleteSiteAlert in tests/src/Kernel/CliCommandsTest.php
Test site alert delete.
SiteAlertTestTrait::loadAlertByLabel in tests/src/Traits/SiteAlertTestTrait.php
Returns the site alert with the given label.

File

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

Class

SiteAlertTestTrait
Helper methods for testing the Site Alert module.

Namespace

Drupal\Tests\site_alert\Traits

Code

protected function loadAlertsByLabel($label) {
  $query = $this->siteAlertStorage
    ->getQuery();
  $query
    ->condition('label', $label, '=');
  $result = $query
    ->execute();
  return $this->siteAlertStorage
    ->loadMultiple($result);
}