public function PluginInstanceConverterTest::testConvertWithUnknownPlugin in Plugin 8.2
@covers ::convert @covers ::doConvert @covers ::validateParameterDefinition @covers ::getConverterDefinitionConstraint @covers ::getConverterDefinition @covers ::getConverterDefinitionKey @covers ::__construct
File
- tests/
src/ Unit/ ParamConverter/ PluginInstanceConverterTest.php, line 169
Class
- PluginInstanceConverterTest
- @coversDefaultClass \Drupal\plugin\ParamConverter\PluginInstanceConverter
Namespace
Drupal\Tests\plugin\Unit\ParamConverterCode
public function testConvertWithUnknownPlugin() {
$plugin_type_id = 'foo_bar.baz';
$definition = [
'plugin.plugin_instance' => [
'plugin_type_id' => $plugin_type_id,
],
];
$plugin_id = 'foozaar.bazaar';
$name = 'foo_bar';
$defaults = [];
$plugin_manager = $this
->prophesize(PluginManagerInterface::class);
$plugin_manager
->hasDefinition($plugin_id)
->willReturn(FALSE);
$plugin_type = $this
->prophesize(PluginTypeInterface::class);
$plugin_type
->getPluginManager()
->willReturn($plugin_manager);
$this->pluginTypeManager
->getPluginType($plugin_type_id)
->willReturn($plugin_type);
$original_error_reporting = error_reporting();
error_reporting($original_error_reporting & ~E_USER_WARNING);
$this
->assertNull($this->sut
->convert($plugin_id, $definition, $name, $defaults));
error_reporting($original_error_reporting);
}