Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300130

Decouple FunctionalTestSetupTrait from the simpletest module

$
0
0

Problem/Motivation

This is a child issue of #3057420: [meta] How to deprecate Simpletest with minimal disruption

We want to allow for the removal of the simpletest module from core.

As part of that process, we try removing the simpletest module: #3075490-17: Move simpletest module to contrib And discover that Drupal\Core\Test\FunctionalTestSetupTrait::prepareSettings() both a) expects there to be a simpletest module, and b) adds a configuration to it:

    // Add the parent profile's search path to the child site's search paths.
    // @see \Drupal\Core\Extension\ExtensionDiscovery::getProfileDirectories()
    $settings['conf']['simpletest.settings']['parent_profile'] = (object) [
      'value' => $this->originalProfile,
      'required' => TRUE,
    ];

This config sneak is then consumed in many places as a way to signal a special case for testing. Here's one: ExtensionDiscovery::setProfileDirectoriesFromSettings().

You can find these usages by searching for 'simpletest.settings' in the codebase.

We also see FunctionalTestSetupTrait adding services in the simpletest namespace.

    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']['simpletest.config_schema_checker'] = [
        'class' => ConfigSchemaChecker::class,
        'arguments' => ['@config.typed', $this->getConfigSchemaExclusions()],
        'tags' => [['name' => 'event_subscriber']],
      ];
      file_put_contents($directory . '/services.yml', $yaml->dump($services));
    }

Fortunately ConfigSchemaChecker is not in a simpletest namespace.

It's unclear from testing whether this matters or not.

Proposed resolution

Figure out how to pass this special-case testing config to consumers. We might consider moving it to the system module's configuration, thus perpetuating the anti-pattern. Or we might fix the whole thing and make testing not be a configured special case, thus improving the testing integrity of Drupal core and the maintainability of the testing systems. But probably the former rather than the latter.

Patch.

Review.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 300130

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>