You are here

public function RangeFieldTest::testAlterFieldWidgetMigration in Range 8

@covers ::alterFieldWidgetMigration @dataProvider alterMigrationDataProvider

File

tests/src/Unit/Plugin/migrate/field/d7/RangeFieldTest.php, line 82

Class

RangeFieldTest
@coversDefaultClass \Drupal\range\Plugin\migrate\field\d7\RangeField @group range

Namespace

Drupal\Tests\range\Unit\Plugin\migrate\field\d7

Code

public function testAlterFieldWidgetMigration($field_type, $is_range_field_type) {
  $this->row
    ->expects(self::once())
    ->method('getSourceProperty')
    ->willReturn($field_type);
  $this->plugin
    ->alterFieldWidgetMigration($this->migration);
  $process = $this->migration
    ->getProcess();
  if ($is_range_field_type) {
    $this
      ->assertSame([
      'range' => 'range',
    ], $process['options/type']['type']['map']);
    $expected_process = [
      'plugin' => 'd7_range_field_instance_widget_settings',
      'source' => 'settings',
    ];
    $this
      ->assertSame([
      $expected_process,
    ], $process['options/settings']);
  }
  else {
    $this
      ->assertArrayNotHasKey('options/settings', $process);
  }
}