You are here

public function RangeFieldTest::testAlterFieldInstanceMigration in Range 8

Same name in this branch
  1. 8 tests/src/Unit/Plugin/migrate/field/d6/RangeFieldTest.php \Drupal\Tests\range\Unit\Plugin\migrate\field\d6\RangeFieldTest::testAlterFieldInstanceMigration()
  2. 8 tests/src/Unit/Plugin/migrate/field/d7/RangeFieldTest.php \Drupal\Tests\range\Unit\Plugin\migrate\field\d7\RangeFieldTest::testAlterFieldInstanceMigration()

@covers ::alterFieldInstanceMigration @dataProvider alterMigrationDataProvider

File

tests/src/Unit/Plugin/migrate/field/d6/RangeFieldTest.php, line 118

Class

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

Namespace

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

Code

public function testAlterFieldInstanceMigration($field_type, $is_range_field_type) {
  $this->row
    ->expects(self::once())
    ->method('getSourceProperty')
    ->willReturn($field_type);
  $this->plugin
    ->alterFieldInstanceMigration($this->migration);
  $process = $this->migration
    ->getProcess();
  if ($is_range_field_type) {
    $expected_process_settings = [
      'plugin' => 'd6_range_field_instance_settings',
    ];
    $this
      ->assertSame([
      $expected_process_settings,
    ], $process['settings']);
    $expected_process_defaults = [
      'plugin' => 'd6_range_field_instance_defaults',
    ];
    $this
      ->assertSame([
      $expected_process_defaults,
    ], $process['default_value']);
  }
  else {
    $this
      ->assertSame([], $process);
  }
}