You are here

public function ListPluginsTest::testTitle in Plugin 8.2

@covers ::title

File

tests/src/Unit/Controller/ListPluginsTest.php, line 108

Class

ListPluginsTest
@coversDefaultClass \Drupal\plugin\Controller\ListPlugins

Namespace

Drupal\Tests\plugin\Unit\Controller

Code

public function testTitle() {
  $class_resolver = $this
    ->createMock(ClassResolverInterface::class);
  $typed_config_manager = $this
    ->createMock(TypedConfigManagerInterface::class);
  $typed_config_manager
    ->expects($this
    ->atLeastOnce())
    ->method('hasConfigSchema')
    ->willReturn(TRUE);
  $plugin_type_id = $this
    ->randomMachineName();
  $plugin_type_label = $this
    ->randomMachineName();
  $plugin_type_definition = [
    'id' => $plugin_type_id,
    'label' => $plugin_type_label,
    'provider' => $this
      ->randomMachineName(),
    'plugin_manager_service_id' => 'foo.bar',
  ];
  $plugin_type = new PluginType($plugin_type_definition, $this->container
    ->reveal(), $this->stringTranslation, $class_resolver, $typed_config_manager);
  $title = $this->sut
    ->title($plugin_type);
  $this
    ->assertStringContainsString($plugin_type_label, (string) $title);
}