X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fprocess%2FBlockVisibilityTest.php;fp=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FUnit%2FPlugin%2Fmigrate%2Fprocess%2FBlockVisibilityTest.php;h=9cb15523d1e4bbdf15a2200d0ada835ddbd3f81c;hp=22b43b569bd845b9872f2a63b6f99d1adb9a2d79;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php index 22b43b569..9cb15523d 100644 --- a/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php +++ b/web/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\block\Unit\Plugin\migrate\process; use Drupal\block\Plugin\migrate\process\BlockVisibility; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\MigrateProcessInterface; use Drupal\Tests\migrate\Unit\process\MigrateProcessTestCase; @@ -80,4 +81,22 @@ class BlockVisibilityTest extends MigrateProcessTestCase { $this->assertEmpty($transformed_value); } + /** + * @covers ::transform + */ + public function testTransformException() { + $this->moduleHandler->moduleExists('php')->willReturn(FALSE); + $migration_plugin = $this->prophesize(MigrateProcessInterface::class); + $this->row = $this->getMockBuilder('Drupal\migrate\Row') + ->disableOriginalConstructor() + ->setMethods(['getSourceProperty']) + ->getMock(); + $this->row->expects($this->exactly(2)) + ->method('getSourceProperty') + ->willReturnMap([['bid', 99], ['module', 'foobar']]); + $this->plugin = new BlockVisibility(['skip_php' => TRUE], 'block_visibility_pages', [], $this->moduleHandler->reveal(), $migration_plugin->reveal()); + $this->setExpectedException(MigrateSkipRowException::class, "The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration."); + $this->plugin->transform([2, 'migrateExecutable, $this->row, 'destinationproperty'); + } + }