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

Refactor TestDatabase to be testable

$
0
0

Problem/Motivation

In #3074043: Move simpletest.module DB-related functions to TestDatabase, deprecate we're trying to deprecate top-level simpletest module functions by moving them to Drupal\Core\Test\TestDatabase.

It so happens that we can't test many of our changes, because TestDatabase is mostly static and thus can't be mocked.

Proposed resolution

  • Test runners (simpletest.module and run-test.sh) run tests opening TestRun objects that have state and an execution log.
  • TestDatabase objects only cares about setting up the SUT database, not the results logging.
  • Each TestRun object is associated with a TestRunResultsStorageInterface object, which responsibility is to store permanently the state and execution log of each test run. This interface is storage agnostic, implementations could use a database or anything else.
  • SimpletestTestRunResultsStorage is at the moment the only implementation of TestRunResultsStorageInterface, which is using the database and the legacy {simpletest} and {simpletest_test_id} tables for the purpose.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 296340

Trending Articles