Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / field / tests / src / Unit / Plugin / migrate / process / d7 / FieldSettingsTest.php
1 <?php
2
3 namespace Drupal\Tests\field\Unit\Plugin\migrate\process\d7;
4
5 use Drupal\field\Plugin\migrate\process\d7\FieldSettings;
6 use Drupal\migrate\Plugin\MigrationInterface;
7 use Drupal\migrate\MigrateExecutableInterface;
8 use Drupal\migrate\Row;
9 use Drupal\Tests\migrate\Unit\MigrateTestCase;
10
11 /**
12  * @coversDefaultClass \Drupal\field\Plugin\migrate\process\d7\FieldSettings
13  * @group field
14  */
15 class FieldSettingsTest extends MigrateTestCase {
16
17   /**
18    * Tests transformation of image field settings.
19    *
20    * @covers ::transform
21    */
22   public function testTransformImageSettings() {
23     $migration = $this->getMock(MigrationInterface::class);
24     $plugin = new FieldSettings([], 'd7_field_settings', [], $migration);
25
26     $executable = $this->getMock(MigrateExecutableInterface::class);
27     $row = $this->getMockBuilder(Row::class)
28       ->disableOriginalConstructor()
29       ->getMock();
30
31     $row->expects($this->atLeastOnce())
32       ->method('getSourceProperty')
33       ->willReturnMap([
34         ['settings', ['default_image' => NULL]],
35         ['type', 'image'],
36       ]);
37
38     $value = $plugin->transform([], $executable, $row, 'foo');
39     $this->assertInternalType('array', $value);
40     $this->assertSame('', $value['default_image']['uuid']);
41   }
42
43 }