public function BlockVisibilityTest::testTransformException in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockVisibilityTest::testTransformException()
@covers ::transform
File
- core/
modules/ block/ tests/ src/ Unit/ Plugin/ migrate/ process/ BlockVisibilityTest.php, line 87
Class
- BlockVisibilityTest
- Tests the block_visibility process plugin.
Namespace
Drupal\Tests\block\Unit\Plugin\migrate\processCode
public function testTransformException() {
$this->moduleHandler
->moduleExists('php')
->willReturn(FALSE);
$migrate_lookup = $this
->prophesize(MigrateLookupInterface::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(), $migrate_lookup
->reveal());
$this
->expectException(MigrateSkipRowException::class);
$this
->expectExceptionMessage("The block with bid '99' from module 'foobar' will have no PHP or request_path visibility configuration.");
$this->plugin
->transform([
2,
'<?php',
[],
], $this->migrateExecutable, $this->row, 'destination_property');
}