function FieldDiscoveryTest::testGetCoreVersion

Same name in other branches
  1. 9 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetCoreVersion()
  2. 8.9.x core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetCoreVersion()
  3. 10 core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php \Drupal\Tests\migrate_drupal\Unit\FieldDiscoveryTest::testGetCoreVersion()

Tests the protected getCoreVersion method.

@covers ::getCoreVersion @dataProvider getCoreVersionData

Parameters

string[] $tags: The migration tags.

string|bool $expected_result: The expected return value of the method.

File

core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php, line 228

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public function testGetCoreVersion(array $tags, $expected_result) : void {
    $migration = $this->prophesize(MigrationInterface::class);
    $migration->getMigrationTags()
        ->willReturn($tags);
    $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager
        ->reveal(), $this->migrationPluginManager
        ->reveal(), $this->logger
        ->reveal());
    if (!$expected_result) {
        $this->expectException(\InvalidArgumentException::class);
    }
    $actual_result = $field_discovery->getCoreVersion($migration->reveal());
    $this->assertEquals($expected_result, $actual_result);
}

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