You are here

public function PluginTypeManagerTest::testGetPluginTypes in Plugin 8.2

Same name in this branch
  1. 8.2 tests/src/Unit/PluginType/PluginTypeManagerTest.php \Drupal\Tests\plugin\Unit\PluginType\PluginTypeManagerTest::testGetPluginTypes()
  2. 8.2 tests/src/Kernel/PluginType/PluginTypeManagerTest.php \Drupal\Tests\plugin\Kernel\PluginType\PluginTypeManagerTest::testGetPluginTypes()

@covers ::getPluginTypes

File

tests/src/Unit/PluginType/PluginTypeManagerTest.php, line 264

Class

PluginTypeManagerTest
@coversDefaultClass \Drupal\plugin\PluginType\PluginTypeManager

Namespace

Drupal\Tests\plugin\Unit\PluginType

Code

public function testGetPluginTypes() {
  $modules = array_map(function (array $plugin_type_definition) {
    $extension = $this
      ->getMockBuilder(Extension::class)
      ->disableOriginalConstructor()
      ->getMock();
    $extension
      ->expects($this
      ->atLeastOnce())
      ->method('getName')
      ->willReturn($plugin_type_definition['provider']);
    return $extension;
  }, $this->pluginTypeDefinitions);
  $this->moduleHandler
    ->expects($this
    ->any())
    ->method('getModuleList')
    ->willReturn($modules);
  $this->typedConfigurationManager
    ->expects($this
    ->any())
    ->method('hasConfigSchema')
    ->willReturn('TRUE');
  foreach ($this->sut
    ->getPluginTypes() as $plugin_type) {
    $this
      ->assertPluginTypeIntegrity($plugin_type
      ->getId(), $this->pluginTypeDefinitions[$plugin_type
      ->getId()], $this->pluginManagers[$plugin_type
      ->getId()], $plugin_type);
  }
}