diff --git a/core/modules/filter/migrations/d7_filter_format.yml b/core/modules/filter/migrations/d7_filter_format.yml index b7491207bcfd..0b5e0b1b5e18 100644 --- a/core/modules/filter/migrations/d7_filter_format.yml +++ b/core/modules/filter/migrations/d7_filter_format.yml @@ -7,6 +7,7 @@ source: plugin: d7_filter_format process: format: format + status: status name: name cache: cache weight: weight diff --git a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php index 0f54245c1af4..7588d2378abf 100644 --- a/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php +++ b/core/modules/filter/tests/src/Kernel/Migrate/d7/MigrateFilterFormatTest.php @@ -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); } } diff --git a/core/modules/migrate_drupal/tests/fixtures/drupal7.php b/core/modules/migrate_drupal/tests/fixtures/drupal7.php index 905c9ee32d19..43489f27ad4e 100644 --- a/core/modules/migrate_drupal/tests/fixtures/drupal7.php +++ b/core/modules/migrate_drupal/tests/fixtures/drupal7.php @@ -15812,7 +15812,7 @@ $connection->insert('filter_format') 'format' => 'php_code', 'name' => 'PHP code', 'cache' => '0', - 'status' => '1', + 'status' => '0', 'weight' => '11', )) ->values(array(