You are here

public function HelpSearchPluginTest::testAnnotation in Drupal 9

Tests search plugin annotation and interfaces.

File

core/modules/help_topics/tests/src/Kernel/HelpSearchPluginTest.php, line 26

Class

HelpSearchPluginTest
Tests search plugin behaviors.

Namespace

Drupal\Tests\help_topics\Kernel

Code

public function testAnnotation() {

  /** @var \Drupal\search\SearchPluginManager $manager */
  $manager = \Drupal::service('plugin.manager.search');

  /** @var \Drupal\help_topics\Plugin\Search\HelpSearch $plugin */
  $plugin = $manager
    ->createInstance('help_search');
  $this
    ->assertInstanceOf(AccessibleInterface::class, $plugin);
  $this
    ->assertInstanceOf(SearchIndexingInterface::class, $plugin);
  $this
    ->assertSame('Help', (string) $plugin
    ->getPluginDefinition()['title']);
  $this
    ->assertTrue($plugin
    ->usesAdminTheme());
}