only in patch2: unchanged: --- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFilterFormatTest.php +++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFilterFormatTest.php @@ -60,9 +60,9 @@ public function testFilterFormat() { $this->assertTrue($filters['filter_html']['status']); // These should be false by default. - $this->assertFalse($filters['filter_html_escape']['status']); - $this->assertFalse($filters['filter_caption']['status']); - $this->assertFalse($filters['filter_html_image_secure']['status']); + $this->assertFalse(isset($filters['filter_html_escape'])); + $this->assertFalse(isset($filters['filter_caption'])); + $this->assertFalse(isset($filters['filter_html_image_secure'])); // Check variables migrated into filter. $this->assertIdentical($filters['filter_html']['settings']['allowed_html'], '
    1. '); only in patch2: unchanged: --- a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php +++ b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php @@ -2,11 +2,12 @@ /** * @file - * Contains \Drupal\system\Tests\Entity\ConfigEntityImportTestBase. + * Contains \Drupal\system\Tests\Entity\ConfigEntityImportTest. */ namespace Drupal\system\Tests\Entity; +use Drupal\Component\Utility\DiffArray; use Drupal\Core\Entity\EntityWithPluginBagsInterface; use Drupal\simpletest\WebTestBase; @@ -110,13 +111,13 @@ protected function doFilterFormatUpdate() { $entity->set('filters', $filters); $entity->save(); $this->assertIdentical($filters, $entity->get('filters')); - $this->assertIdentical($filters, $plugin_bag->getConfiguration()); + $this->assertIdentical($filters, $this->filterFilters($plugin_bag->getConfiguration())); $filters['filter_url']['settings']['filter_url_length'] = -100; $entity->getPluginBags()['filters']->setConfiguration($filters); $entity->save(); $this->assertIdentical($filters, $entity->get('filters')); - $this->assertIdentical($filters, $plugin_bag->getConfiguration()); + $this->assertIdentical($filters, $this->filterFilters($plugin_bag->getConfiguration())); // Read the existing data, and prepare an altered version in staging. $custom_data = $original_data = $this->container->get('config.storage')->read($name); @@ -125,6 +126,28 @@ protected function doFilterFormatUpdate() { } /** + * Filters an array of filters to only include customised filters. + * + * @param array $filters + * An array fo filter plugin configuration keyed by plugin ID. + * + * @return array + * The filtered array of filters. + */ + protected function filterFilters(array $filters) { + return array_filter($filters, function($filter) { + $default = \Drupal::service('plugin.manager.filter')->getDefinition($filter['id']); + if (!$filter['status']) { + // Compare the current settings to the default settings. If there are + // any customisations save them to configuration. + $diff = DiffArray::diffAssocRecursive($filter, $default); + return !empty($diff); + } + return TRUE; + }); + } + + /** * Tests updating an image style during import. */ protected function doImageStyleUpdate() {