X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Ffile%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2Fd7%2FImageCckTest.php;fp=web%2Fcore%2Fmodules%2Ffile%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2Fd7%2FImageCckTest.php;h=2175c64215d3bc64c2d53c9f12dc8265c4d23a69;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php b/web/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php new file mode 100644 index 000000000..2175c6421 --- /dev/null +++ b/web/core/modules/file/tests/src/Unit/Plugin/migrate/cckfield/d7/ImageCckTest.php @@ -0,0 +1,66 @@ +plugin = new ImageField([], 'image', []); + + $migration = $this->prophesize(MigrationInterface::class); + + // The plugin's processFieldValues() method will call + // mergeProcessOfProperty() and return nothing. So, in order to examine the + // process pipeline created by the plugin, we need to ensure that + // getProcess() always returns the last input to mergeProcessOfProperty(). + $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array')) + ->will(function ($arguments) use ($migration) { + $migration->getProcess()->willReturn($arguments[1]); + }); + $this->migration = $migration->reveal(); + } + + /** + * @covers ::processCckFieldValues + */ + public function testProcessCckFieldValues() { + $this->plugin->processCckFieldValues($this->migration, 'somefieldname', []); + + $expected = [ + 'plugin' => 'sub_process', + 'source' => 'somefieldname', + 'process' => [ + 'target_id' => 'fid', + 'alt' => 'alt', + 'title' => 'title', + 'width' => 'width', + 'height' => 'height', + ], + ]; + $this->assertSame($expected, $this->migration->getProcess()); + } + +}