You are here

public function MessageDigestTest::testDigestNotifierPluginsExist in Message Digest 8

Tests the plugin deriver for daily and weekly digests.

File

tests/src/Kernel/MessageDigestTest.php, line 19

Class

MessageDigestTest
Kernel tests for Message Digest.

Namespace

Drupal\Tests\message_digest\Kernel

Code

public function testDigestNotifierPluginsExist() {
  $count = 0;
  foreach ($this->notifierManager
    ->getDefinitions() as $plugin_id => $plugin_definition) {
    if ($plugin_definition['provider'] === 'message_digest') {
      $dummy = Message::create([
        'template' => 'foo',
      ]);

      // Ensure the plugin can be instantiated.
      $this->notifierManager
        ->createInstance($plugin_id, [], $dummy);
      $count++;
    }
  }
  $this
    ->assertEquals(2, $count, 'There are 2 digest notifiers.');
}