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

Testing framework does not work with contributed database drivers

$
0
0

Problem/Motivation

The testing framework is unable to use contributed drivers for KernelTests and FunctionalTests because when calling PHPUnit it passes the connection URL, and there is no available logic to identify and load non-core database drivers' code.

Proposed resolution

Make the needed modifications so that the proper database connection string can be passed between environments so that tests can be run:

  • Ensure that Database::getConnectionInfoAsUrl() contains the all the necessary information that is specified in the connection, also for non-core database drivers
  • Add helper methods to adapt an Uri object with with connections options for the username and password
  • Componentize and centralize the conversion between Drupal's connection array and a connection URI and back
  • Add test coverage

Note: someone raised concerns (#92) about uri manipulation tools used from guzzlehttp/psr7 to manipulate URI's. It makes sense to use a standarized URI manipulation tool to manipulate URI's rather than doing this manually (and hence in a more fragile and less maintainable way). The specific issue raised is that doing so adds a dependency of the database abstraction layer on a third party library (that is already being used by Core). Drupal is encouraging more and more a deeper PHP ecosystem integration by using widespread tools through 3d party libraries and components.

Proposed Change Record

https://www.drupal.org/node/2896416

Remaining tasks

RBTC

Decide whether its okay to add a dependency to a HTTP library into the database system.

User interface changes

None

API changes

Added a couple of helper methods to the database abstraction layer.

Three functions in core/install.inc are deprecated:

  • drupal_detect_database_types()
  • drupal_get_database_types()
  • db_installer_object($driver)

See proposed change record.

Data model changes

None


Viewing all articles
Browse latest Browse all 300586

Trending Articles



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