You are here

function PluginSelectorBaseTest::testCreate in Plugin 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/Plugin/PluginSelector/PluginSelectorBaseTest.php, line 41

Class

PluginSelectorBaseTest
@coversDefaultClass \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorBase

Namespace

Drupal\Tests\plugin\Unit\Plugin\Plugin\PluginSelector

Code

function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = [
    [
      'plugin.default_plugin_resolver',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->defaultPluginResolver,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

  /** @var \Drupal\plugin\Plugin\Plugin\PluginSelector\PluginSelectorBase $class */
  $class = get_class($this->sut);
  $plugin = $class::create($container, [], $this->pluginId, $this->pluginDefinition);
  $this
    ->assertInstanceOf(get_class($this->sut), $plugin);
}