function BlockRegionTest::transform

Same name and namespace in other branches
  1. 9 core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockRegionTest::transform()
  2. 8.9.x core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php \Drupal\Tests\block\Unit\Plugin\migrate\process\BlockRegionTest::transform()
  3. 11.x 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
Tests transforming a block with the same theme and an existing region.
BlockRegionTest::testTransformSameThemeRegionNotExists in core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php
Tests transforming a block with the same theme and a non-existent region.

File

core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockRegionTest.php, line 29

Class

BlockRegionTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21block%21src%21Plugin%21migrate%21process%21BlockRegion.php/class/BlockRegion/10" title="BlockRegion" class="local">\Drupal\block\Plugin\migrate\process\BlockRegion</a> @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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.