getConfigSchemaExclusions example

$this->keyValue = new KeyValueMemoryFactory();
    }
    $container->set('keyvalue', $this->keyValue);

    // Set the default language on the minimal container.     $container->setParameter('language.default_values', Language::$defaultValues);

    if ($this->strictConfigSchema) {
      $container
        ->register('testing.config_schema_checker', ConfigSchemaChecker::class)
        ->addArgument(new Reference('config.typed'))
        ->addArgument($this->getConfigSchemaExclusions())
        ->addTag('event_subscriber');
    }

    if ($container->hasDefinition('path_alias.path_processor')) {
      // The alias-based processor requires the path_alias entity schema to be       // installed, so we prevent it from being registered to the path processor       // manager. We do this by removing the tags that the compiler pass looks       // for. This means that the URL generator can safely be used within tests.       $container->getDefinition('path_alias.path_processor')
        ->clearTag('path_processor_inbound')
        ->clearTag('path_processor_outbound');
    }
// If we have successfully clicked 'Apply pending updates' then we need to       // clear the caches in the update test runner as this has occurred as part       // of the updates.       $this->resetAll();

      // The config schema can be incorrect while the update functions are being       // executed. But once the update has been completed, it needs to be valid       // again. Assert the schema of all configuration objects now.       $names = $this->container->get('config.storage')->listAll();

      // Allow tests to opt out of checking specific configuration.       $exclude = $this->getConfigSchemaExclusions();
      /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */
      $typed_config = $this->container->get('config.typed');
      foreach ($names as $name) {
        if (in_array($name$exclude, TRUE)) {
          // Skip checking schema if the config is listed in the           // $configSchemaCheckerExclusions property.           continue;
        }
        $config = $this->config($name);
        $this->assertConfigSchema($typed_config$name$config->get());
      }

      
      $settings_services_file = DRUPAL_ROOT . '/sites/default/default.services.yml';
    }
    // Copy the testing-specific service overrides in place.     copy($settings_services_file$directory . '/services.yml');
    if ($this->strictConfigSchema) {
      // Add a listener to validate configuration schema on save.       $yaml = new SymfonyYaml();
      $content = file_get_contents($directory . '/services.yml');
      $services = $yaml->parse($content);
      $services['services']['testing.config_schema_checker'] = [
        'class' => ConfigSchemaChecker::class,
        'arguments' => ['@config.typed', $this->getConfigSchemaExclusions()],
        'tags' => [['name' => 'event_subscriber']],
      ];
      file_put_contents($directory . '/services.yml', $yaml->dump($services));
    }
    // Since Drupal is bootstrapped already, install_begin_request() will not     // bootstrap again. Hence, we have to reload the newly written custom     // settings.php manually.     Settings::initialize(DRUPAL_ROOT, $this->siteDirectory, $this->classLoader);
  }

  /** * Rewrites the settings.php file of the test site. * * @param array $settings * An array of settings to write out, in the format expected by * SettingsEditor::rewrite(). * * @see \Drupal\Core\Site\SettingsEditor::rewrite() */
Home | Imprint | This part of the site doesn't use cookies.