function FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition()
  2. 10 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetFieldInstanceStubMigrationDefinition()
  3. 11.x 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\Unit

Code

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);
}

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