You are here

public function MediaWysiwygPluginBaseTest::testPluginConstruct in Media Migration 8

Tests Media WYSIWYG plugin construction.

@covers ::__construct @dataProvider providerTestPluginConstruct

File

tests/src/Unit/MediaWysiwygPluginBaseTest.php, line 26

Class

MediaWysiwygPluginBaseTest
Tests the Bean Media WYSIWYG plugin.

Namespace

Drupal\Tests\media_migration\Unit

Code

public function testPluginConstruct(array $config, array $plugin_definition, $expected_exception_regex) {
  if ($expected_exception_regex) {
    $this
      ->expectException(PluginException::class);
    if (is_callable([
      $this,
      'expectExceptionMessageMatches',
    ])) {
      $this
        ->expectExceptionMessageMatches($expected_exception_regex);
    }
    else {
      $this
        ->expectExceptionMessageRegExp($expected_exception_regex);
    }
  }
  $plugin = $this
    ->getMockBuilder(MediaWysiwygPluginBase::class)
    ->setConstructorArgs([
    $config,
    'test_plugin_id',
    $plugin_definition,
  ])
    ->setMethods(NULL)
    ->getMock();
  $this
    ->assertInstanceOf(MediaWysiwygPluginBase::class, $plugin);
}