function FieldDiscoveryTestTrait::assertFieldProcessKeys
Same name in other branches
- 9 core/modules/migrate_drupal/tests/src/Traits/FieldDiscoveryTestTrait.php \Drupal\Tests\migrate_drupal\Traits\FieldDiscoveryTestTrait::assertFieldProcessKeys()
- 8.9.x core/modules/migrate_drupal/tests/src/Traits/FieldDiscoveryTestTrait.php \Drupal\Tests\migrate_drupal\Traits\FieldDiscoveryTestTrait::assertFieldProcessKeys()
- 10 core/modules/migrate_drupal/tests/src/Traits/FieldDiscoveryTestTrait.php \Drupal\Tests\migrate_drupal\Traits\FieldDiscoveryTestTrait::assertFieldProcessKeys()
Asserts the field discovery returns the expected processes.
Parameters
\Drupal\migrate_drupal\FieldDiscoveryInterface $field_discovery: The Field Discovery service.
\Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager: The migration plugin manager service.
string $core: The Drupal core version, either '6', or '7'.
array $expected_process_keys: (optional) The expected resulting process_keys.
string $entity_type_id: (optional) The entity type id.
string $bundle: (optional) The bundle.
2 calls to FieldDiscoveryTestTrait::assertFieldProcessKeys()
- FieldDiscoveryTest::testAddAllFieldProcesses in core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d6/ FieldDiscoveryTest.php - Tests the addAllFieldProcesses method.
- FieldDiscoveryTest::testAddAllFieldProcesses in core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d7/ FieldDiscoveryTest.php - Tests the addAllFieldProcesses method.
File
-
core/
modules/ migrate_drupal/ tests/ src/ Traits/ FieldDiscoveryTestTrait.php, line 69
Class
- FieldDiscoveryTestTrait
- Helper functions to test field discovery.
Namespace
Drupal\Tests\migrate_drupal\TraitsCode
public function assertFieldProcessKeys(FieldDiscoveryInterface $field_discovery, MigrationPluginManagerInterface $migration_plugin_manager, $core, array $expected_process_keys, $entity_type_id = NULL, $bundle = NULL) {
$definition = [
'migration_tags' => [
'Drupal ' . $core,
],
];
$migration = $migration_plugin_manager->createStubMigration($definition);
if ($bundle) {
$field_discovery->addBundleFieldProcesses($migration, $entity_type_id, $bundle);
}
elseif ($entity_type_id) {
$field_discovery->addEntityFieldProcesses($migration, $entity_type_id);
}
else {
$field_discovery->addAllFieldProcesses($migration);
}
$actual_process = $migration->getProcess();
$actual = array_keys($actual_process);
$this->assertSame(sort($expected_process_keys), sort($actual));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.