public function MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Kernel/Plugin/MigrationProvidersExistTest.php \Drupal\Tests\migrate\Kernel\Plugin\MigrationProvidersExistTest::testFieldProviderMissingRequiredProperty()
- 9 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 176
Class
- MigrationProvidersExistTest
- Tests that modules exist for all source and destination plugins.
Namespace
Drupal\Tests\migrate\Kernel\PluginCode
public function testFieldProviderMissingRequiredProperty(array $definitions, $missing_property) {
$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();
}