function FieldDiscoveryTestTrait::assertFieldProcess
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'.
string $field_plugin_method: (optional) The field plugin method to use.
array $expected_process: (optional) The expected resulting process.
string $entity_type_id: (optional) The entity type id.
string $bundle: (optional) The bundle.
2 calls to FieldDiscoveryTestTrait::assertFieldProcess()
- FieldDiscoveryTest::testAddAllFieldProcessesAlters in core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d6/ FieldDiscoveryTest.php  - Tests the addAllFieldProcesses method for field migrations.
 - FieldDiscoveryTest::testAddAllFieldProcessesAlters in core/
modules/ migrate_drupal/ tests/ src/ Kernel/ d7/ FieldDiscoveryTest.php  - Tests the addAllFieldProcesses method for field migrations.
 
File
- 
              core/
modules/ migrate_drupal/ tests/ src/ Traits/ FieldDiscoveryTestTrait.php, line 34  
Class
- FieldDiscoveryTestTrait
 - Helper functions to test field discovery.
 
Namespace
Drupal\Tests\migrate_drupal\TraitsCode
public function assertFieldProcess(FieldDiscoveryInterface $field_discovery, MigrationPluginManagerInterface $migration_plugin_manager, $core, $field_plugin_method = NULL, array $expected_process = [], $entity_type_id = NULL, $bundle = NULL) {
  $definition = [
    'migration_tags' => [
      'Drupal ' . $core,
    ],
    'field_plugin_method' => $field_plugin_method,
  ];
  $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();
  $this->assertSame($expected_process, $actual_process);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.