You are here

public function FieldDiscoveryTest::testGetCoreVersion in Drupal 8

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

Test 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 226

Class

FieldDiscoveryTest
Tests the FieldDiscovery Class.

Namespace

Drupal\Tests\migrate_drupal\Unit

Code

public function testGetCoreVersion(array $tags, $expected_result) {
  $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);
}