You are here

function AdvancedPluginSelectorBaseTest::testCreate in Plugin 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBaseTest.php, line 62

Class

AdvancedPluginSelectorBaseTest
@coversDefaultClass \Drupal\plugin\Plugin\Plugin\PluginSelector\AdvancedPluginSelectorBase

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,
    ],
    [
      'string_translation',
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $this->stringTranslation,
    ],
  ];
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

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