You are here

protected function BlockRegionTest::transform in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockRegionTest::transform()

Transforms a value through the block_region plugin.

Parameters

array $value: The value to transform.

\Drupal\migrate\Row|NULL $row: (optional) The mocked row.

Return value

array|string The transformed value.

2 calls to BlockRegionTest::transform()
BlockRegionTest::testTransformSameThemeRegionExists in core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
If the source and destination themes are identical, the region should only be passed through if it actually exists in the destination theme.
BlockRegionTest::testTransformSameThemeRegionNotExists in core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
If the source and destination themes are identical, the region should be changed to 'content' if it doesn't exist in the destination theme.

File

core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php, line 32
Contains \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockRegionTest.

Class

BlockRegionTest
@coversDefaultClass \Drupal\block\Plugin\migrate\process\BlockRegion @group block

Namespace

Drupal\Tests\block\Unit\Plugin\migrate\process

Code

protected function transform(array $value, Row $row = NULL) {
  $executable = $this
    ->prophesize(MigrateExecutableInterface::class)
    ->reveal();
  if (empty($row)) {
    $row = $this
      ->prophesize(Row::class)
      ->reveal();
  }
  $regions = array(
    'bartik' => array(
      'triptych_first' => 'Triptych first',
      'triptych_second' => 'Triptych second',
      'triptych_third' => 'Triptych third',
    ),
  );
  $plugin = new BlockRegion([
    'region_map' => [],
  ], 'block_region', [], $regions);
  return $plugin
    ->transform($value, $executable, $row, 'foo');
}