X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fprocess%2FBlockRegionTest.php;fp=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fprocess%2FBlockRegionTest.php;h=f473dc4c83c27ac56609c9ad17eb59f1b64e93f4;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php new file mode 100644 index 000000000..f473dc4c8 --- /dev/null +++ b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php @@ -0,0 +1,70 @@ +prophesize(MigrateExecutableInterface::class)->reveal(); + if (empty($row)) { + $row = $this->prophesize(Row::class)->reveal(); + } + + $configuration = [ + 'map' => [ + 'bartik' => [ + 'bartik' => [ + 'triptych_first' => 'triptych_first', + 'triptych_middle' => 'triptych_second', + 'triptych_last' => 'triptych_third', + ], + ], + ], + 'default_value' => 'content', + ]; + + $plugin = new BlockRegion($configuration, 'block_region', [], $configuration['map']['bartik']['bartik']); + return $plugin->transform($value, $executable, $row, 'foo'); + } + + /** + * If the source and destination themes are identical, the region should only + * be passed through if it actually exists in the destination theme. + * + * @covers ::transform + */ + public function testTransformSameThemeRegionExists() { + $this->assertSame('triptych_second', $this->transform(['bartik', 'bartik', 'triptych_middle'])); + } + + /** + * If the source and destination themes are identical, the region should be + * changed to 'content' if it doesn't exist in the destination theme. + * + * @covers ::transform + */ + public function testTransformSameThemeRegionNotExists() { + $this->assertSame('content', $this->transform(['bartik', 'bartik', 'footer'])); + } + +}