X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Ftaxonomy%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2FTaxonomyTermReferenceCckTest.php;fp=web%2Fcore%2Fmodules%2Ftaxonomy%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fcckfield%2FTaxonomyTermReferenceCckTest.php;h=437fd67e270a8c02069e859b441567fdf351ca9e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php b/web/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php new file mode 100644 index 000000000..437fd67e2 --- /dev/null +++ b/web/core/modules/taxonomy/tests/src/Unit/Plugin/migrate/cckfield/TaxonomyTermReferenceCckTest.php @@ -0,0 +1,63 @@ +plugin = new TaxonomyTermReference([], 'taxonomy', []); + + $migration = $this->prophesize(MigrationInterface::class); + + // The plugin's processCckFieldValues() method will call + // setProcessOfProperty() 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 setProcessOfProperty(). + $migration->setProcessOfProperty(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->processFieldValues($this->migration, 'somefieldname', []); + + $expected = [ + 'plugin' => 'sub_process', + 'source' => 'somefieldname', + 'process' => [ + 'target_id' => 'tid', + ], + ]; + $this->assertSame($expected, $this->migration->getProcess()); + } + +}