You are here

public function FilterSettingsTest::testTransform in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::testTransform()
  2. 9 core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php \Drupal\Tests\filter\Kernel\Plugin\migrate\process\FilterSettingsTest::testTransform()

Tests transformation of filter settings.

@dataProvider dataProvider @covers ::transform

File

core/modules/filter/tests/src/Kernel/Plugin/migrate/process/FilterSettingsTest.php, line 25

Class

FilterSettingsTest
Unit tests of the filter_settings plugin.

Namespace

Drupal\Tests\filter\Kernel\Plugin\migrate\process

Code

public function testTransform($value, $destination_id, $expected_value) {
  $migration = $this
    ->createMock(MigrationInterface::class);
  $plugin = new FilterSettings([], 'filter_settings', [], $migration);
  $executable = $this
    ->createMock(MigrateExecutableInterface::class);
  $row = $this
    ->getMockBuilder(Row::class)
    ->disableOriginalConstructor()
    ->getMock();
  $row
    ->expects($this
    ->atLeastOnce())
    ->method('getDestinationProperty')
    ->willReturn($destination_id);
  $output_value = $plugin
    ->transform($value, $executable, $row, 'foo');
  $this
    ->assertSame($expected_value, $output_value);
}