X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flink%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2FLinkCckTest.php;fp=web%2Fcore%2Fmodules%2Flink%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2FLinkCckTest.php;h=7029d72412e9efa9dc1107ee6fc1495195fba686;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php b/web/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php new file mode 100644 index 000000000..7029d7241 --- /dev/null +++ b/web/core/modules/link/tests/src/Unit/Plugin/migrate/cckfield/LinkCckTest.php @@ -0,0 +1,60 @@ +plugin = new LinkField([], 'link', []); + + $migration = $this->prophesize(MigrationInterface::class); + + // The plugin's processCckFieldValues() 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' => 'd6_cck_link', + 'source' => 'somefieldname', + ]; + $this->assertSame($expected, $this->migration->getProcess()); + } + +}