You are here

public function PluginTypeConverterTest::testConvertWithKnownPluginType in Plugin 8.2

@covers ::convert @covers ::doConvert @covers ::validateParameterDefinition @covers ::getConverterDefinitionConstraint @covers ::getConverterDefinition @covers ::getConverterDefinitionKey @covers ::__construct

File

tests/src/Unit/ParamConverter/PluginTypeConverterTest.php, line 119

Class

PluginTypeConverterTest
@coversDefaultClass \Drupal\plugin\ParamConverter\PluginTypeConverter

Namespace

Drupal\Tests\plugin\Unit\ParamConverter

Code

public function testConvertWithKnownPluginType() {
  $plugin_type_id = 'foo_bar.baz';
  $definition = [
    'plugin.plugin_type' => [],
  ];
  $name = 'foo_bar';
  $defaults = [];
  $plugin_type = $this
    ->prophesize(PluginTypeInterface::class);
  $this->pluginTypeManager
    ->hasPluginType($plugin_type_id)
    ->willReturn(TRUE);
  $this->pluginTypeManager
    ->getPluginType($plugin_type_id)
    ->willReturn($plugin_type
    ->reveal());
  $this
    ->assertSame($plugin_type
    ->reveal(), $this->sut
    ->convert($plugin_type_id, $definition, $name, $defaults));
}