3 namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d6;
5 use Drupal\field\Plugin\migrate\process\d6\FieldSettings;
6 use Drupal\migrate\Plugin\MigrationInterface;
7 use Drupal\migrate\MigrateExecutableInterface;
8 use Drupal\migrate\Row;
9 use Drupal\Tests\UnitTestCase;
12 * @coversDefaultClass \Drupal\field\Plugin\migrate\process\d6\FieldSettings
15 class FieldSettingsTest extends UnitTestCase {
18 * @covers ::getSettings
20 * @dataProvider getSettingsProvider
22 public function testGetSettings($field_type, $field_settings, $allowed_values) {
23 $migration = $this->getMock(MigrationInterface::class);
24 $plugin = new FieldSettings([], 'd6_field_settings', [], $migration);
26 $executable = $this->getMock(MigrateExecutableInterface::class);
27 $row = $this->getMockBuilder(Row::class)
28 ->disableOriginalConstructor()
31 $result = $plugin->transform([$field_type, $field_settings, NULL], $executable, $row, 'foo');
32 $this->assertSame($allowed_values, $result['allowed_values']);
36 * Provides field settings for testGetSettings().
38 public function getSettingsProvider() {
42 ['allowed_values' => "1|One\n2|Two\n3"],
51 ['allowed_values' => NULL],
56 ['allowed_values' => ""],