You are here

protected function BlockRegionTest::transform in Drupal 9

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 27

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();
  }
  $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');
}