function MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty

Same name in other branches
  1. 9 core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty()
  2. 8.9.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty()
  3. 11.x core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty()

Tests a missing required definition.

@dataProvider fieldPluginDefinitionsProvider

Parameters

array $definitions: A field plugin definition.

string $missing_property: The name of the property missing from the definition.

File

core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php, line 179

Class

MigrationProvidersExistTest
Tests that modules exist for all source and destination plugins.

Namespace

Drupal\Tests\migrate\Kernel\Plugin

Code

public function testFieldProviderMissingRequiredProperty(array $definitions, $missing_property) : void {
    $discovery = $this->getMockBuilder(MigrateFieldPluginManager::class)
        ->disableOriginalConstructor()
        ->onlyMethods([
        'getDefinitions',
    ])
        ->getMock();
    $discovery->method('getDefinitions')
        ->willReturn($definitions);
    $plugin_manager = $this->getMockBuilder(MigrateFieldPluginManager::class)
        ->disableOriginalConstructor()
        ->onlyMethods([
        'getDiscovery',
    ])
        ->getMock();
    $plugin_manager->method('getDiscovery')
        ->willReturn($discovery);
    $this->expectException(BadPluginDefinitionException::class);
    $this->expectExceptionMessage("The missing_{$missing_property} plugin must define the {$missing_property} property.");
    $plugin_manager->getDefinitions();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.