Issue #3095339 by Wim Leers, longwave, heddn, quietone: Text formats disabled in D7 are migrated to D8 as enabled
parent
1e04ea32c6
commit
798af1ff30
|
@ -7,6 +7,7 @@ source:
|
|||
plugin: d7_filter_format
|
||||
process:
|
||||
format: format
|
||||
status: status
|
||||
name: name
|
||||
cache: cache
|
||||
weight: weight
|
||||
|
|
|
@ -38,8 +38,10 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
|
|||
* The expected filters in the format, keyed by ID with weight as values.
|
||||
* @param int $weight
|
||||
* The weight of the filter.
|
||||
* @param bool $status
|
||||
* The status of the filter.
|
||||
*/
|
||||
protected function assertEntity($id, $label, array $enabled_filters, $weight) {
|
||||
protected function assertEntity($id, $label, array $enabled_filters, $weight, $status) {
|
||||
/** @var \Drupal\filter\FilterFormatInterface $entity */
|
||||
$entity = FilterFormat::load($id);
|
||||
$this->assertInstanceOf(FilterFormatInterface::class, $entity);
|
||||
|
@ -47,6 +49,7 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
|
|||
// get('filters') will return enabled filters only, not all of them.
|
||||
$this->assertSame(array_keys($enabled_filters), array_keys($entity->get('filters')));
|
||||
$this->assertSame($weight, $entity->get('weight'));
|
||||
$this->assertSame($status, $entity->status());
|
||||
foreach ($entity->get('filters') as $filter_id => $filter) {
|
||||
$this->assertSame($filter['weight'], $enabled_filters[$filter_id]);
|
||||
}
|
||||
|
@ -56,10 +59,10 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
|
|||
* Tests the Drupal 7 filter format to Drupal 8 migration.
|
||||
*/
|
||||
public function testFilterFormat() {
|
||||
$this->assertEntity('custom_text_format', 'Custom Text format', ['filter_autop' => 0, 'filter_html' => -10], 0);
|
||||
$this->assertEntity('filtered_html', 'Filtered HTML', ['filter_autop' => 2, 'filter_html' => 1, 'filter_htmlcorrector' => 10, 'filter_url' => 0], 0);
|
||||
$this->assertEntity('full_html', 'Full HTML', ['filter_autop' => 1, 'filter_htmlcorrector' => 10, 'filter_url' => 0], 1);
|
||||
$this->assertEntity('plain_text', 'Plain text', ['filter_html_escape' => 0, 'filter_url' => 1, 'filter_autop' => 2], 10);
|
||||
$this->assertEntity('custom_text_format', 'Custom Text format', ['filter_autop' => 0, 'filter_html' => -10], 0, TRUE);
|
||||
$this->assertEntity('filtered_html', 'Filtered HTML', ['filter_autop' => 2, 'filter_html' => 1, 'filter_htmlcorrector' => 10, 'filter_url' => 0], 0, TRUE);
|
||||
$this->assertEntity('full_html', 'Full HTML', ['filter_autop' => 1, 'filter_htmlcorrector' => 10, 'filter_url' => 0], 1, TRUE);
|
||||
$this->assertEntity('plain_text', 'Plain text', ['filter_html_escape' => 0, 'filter_url' => 1, 'filter_autop' => 2], 10, TRUE);
|
||||
// This assertion covers issue #2555089. Drupal 7 formats are identified
|
||||
// by machine names, so migrated formats should be merged into existing
|
||||
// ones.
|
||||
|
@ -74,11 +77,9 @@ class MigrateFilterFormatTest extends MigrateDrupal7TestBase {
|
|||
$config = $format->filters('filter_url')->getConfiguration();
|
||||
$this->assertSame(128, $config['settings']['filter_url_length']);
|
||||
|
||||
// The php_code format gets migrated, but the php_code filter is changed to
|
||||
// filter_null.
|
||||
$format = FilterFormat::load('php_code');
|
||||
$this->assertInstanceOf(FilterFormatInterface::class, $format);
|
||||
$this->assertArrayHasKey('filter_null', $format->get('filters'));
|
||||
// The disabled php_code format gets migrated, but the php_code filter is
|
||||
// changed to filter_null.
|
||||
$this->assertEntity('php_code', 'PHP code', ['filter_null' => 0], 11, FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15812,7 +15812,7 @@ $connection->insert('filter_format')
|
|||
'format' => 'php_code',
|
||||
'name' => 'PHP code',
|
||||
'cache' => '0',
|
||||
'status' => '1',
|
||||
'status' => '0',
|
||||
'weight' => '11',
|
||||
))
|
||||
->values(array(
|
||||
|
|
Loading…
Reference in New Issue