You are here

public function PluginTypeConverterTest::testConvertWithExceptionReturnsNull 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 94

Class

PluginTypeConverterTest
@coversDefaultClass \Drupal\plugin\ParamConverter\PluginTypeConverter

Namespace

Drupal\Tests\plugin\Unit\ParamConverter

Code

public function testConvertWithExceptionReturnsNull() {
  $plugin_type_id = 'foo_bar.baz';
  $definition = [
    'plugin.plugin_type' => [],
  ];
  $name = 'foo_bar';
  $defaults = [];
  $this->pluginTypeManager
    ->hasPluginType($plugin_type_id)
    ->willReturn(FALSE);
  $original_error_reporting = error_reporting();
  error_reporting($original_error_reporting & ~E_USER_WARNING);
  $this
    ->assertNull($this->sut
    ->convert($plugin_type_id, $definition, $name, $defaults));
  error_reporting($original_error_reporting);
}