Skip to content
Snippets Groups Projects
Commit 543caad0 authored by catch's avatar catch
Browse files

Issue #3191490 by quietone, huzooka, Wim Leers: Migrate d6 and d7 block...

Issue #3191490 by quietone, huzooka, Wim Leers: Migrate d6 and d7 block (configs) with title "<none>" with "label_display" set to "0"
parent 211f695a
Branches
Tags
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
......@@ -23,7 +23,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
list($plugin, $delta, $old_settings, $title) = $value;
$settings = [];
$settings['label'] = $title;
if ($title) {
if ($title && $title !== '<none>') {
$settings['label_display'] = BlockPluginInterface::BLOCK_LABEL_VISIBLE;
}
else {
......
<?php
namespace Drupal\Tests\block\Unit\Plugin\migrate\process;
use Drupal\block\Plugin\migrate\process\BlockSettings;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
use Drupal\Tests\UnitTestCase;
/**
* @coversDefaultClass \Drupal\block\Plugin\migrate\process\BlockSettings
* @group block
*/
class BlockSettingsTest extends UnitTestCase {
/**
* Tests the blocks settings process plugin.
*
* @param array $value
* The source value for the plugin.
* @param array $expected
* The expected result.
*
* @covers ::transform
*
* @dataProvider providerTestTransform
*/
public function testTransform($value, $expected) {
$executable = $this->prophesize(MigrateExecutableInterface::class)
->reveal();
if (empty($row)) {
$row = $this->prophesize(Row::class)->reveal();
}
$plugin = new BlockSettings([], 'block_settings', [], 'foo');
$actual = $plugin->transform($value, $executable, $row, 'foo');
$this->assertSame($expected, $actual);
}
/**
* Provides data for testTransform.
*/
public function providerTestTransform() {
return [
'title set' => [
[
'custom',
0,
'foo',
'title',
],
[
'label' => 'title',
'label_display' => 'visible',
],
],
'title empty' => [
[
'custom',
0,
'foo',
'',
],
[
'label' => '',
'label_display' => '0',
],
],
'title <none>' => [
[
'custom',
0,
'foo',
'<none>',
],
[
'label' => '<none>',
'label_display' => '0',
],
],
];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment