public function FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition()
- 9 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition()
Tests the getFieldInstanceStubMigration method.
@covers ::getFieldInstanceStubMigrationDefinition @dataProvider getFieldInstanceStubMigrationDefinition
Parameters
mixed $core: The Drupal core version.
array|bool $expected_definition: The expected migration definition, or false if an exception is expected.
File
- core/modules/ migrate_drupal/ tests/ src/ Unit/ FieldDiscoveryTest.php, line 316 
Class
- FieldDiscoveryTest
- Tests the FieldDiscovery Class.
Namespace
Drupal\Tests\migrate_drupal\UnitCode
public function testGetFieldInstanceStubMigrationDefinition($core, $expected_definition) {
  $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager
    ->reveal(), $this->migrationPluginManager
    ->reveal(), $this->logger
    ->reveal());
  if (!$expected_definition) {
    $this
      ->expectException(\InvalidArgumentException::class);
    $this
      ->expectExceptionMessage(sprintf("Drupal version %s is not supported. Valid values for Drupal core version are '6' and '7'.", $core));
  }
  $actual_definition = $field_discovery
    ->getFieldInstanceStubMigrationDefinition($core);
  $this
    ->assertSame($expected_definition, $actual_definition);
}