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

Add InstallerInterface to provide a stable non-interactive installer

$
0
0

Problem

In order to do automated performance tracking of core, we first need a reliable way of installing core. We have drush site-install, but it can be broken by changes to core. Even if drush responds within days with a fix, there's no simple way to associate a working version of core with a working version of drush.

We also have the install_drupal function (which site-install uses) that takes only a $settings array, formatted in a form-centric way. Code that uses it has to have intimate knowledge of this data structure. Also, it requires more than just that array to function, giving it implicit dependencies.

Solution

The purpose of this patch is to introduce an InstallerInterface which makes each parameter of the installation process explicit. Code that uses this interface should always work, regardless of changes to Drupal itself.

Our requirements for the installation process don't change often, so this interface should be very stable. In the event that we do need to change it, we would create a new version. This provides a reliable mechanism for code to detect what interface should be used, when that code needs to be able to install more than a single version of Drupal.

The provided implementation of this interface acts as a wrapper around the install_drupal function. When we outgrow install_drupal, we simply change the guts of this class and existing code will still work.

Tests

This patch also includes a unit test and an acceptance test, both using PHPUnit. I looked at the existing installer simpletests, and the work necessary to unset and reset the state of the current Drupal request seems far to dangerous for a non-interactive install.

It uses the @runTestsInSeparateProcesses annotation to keep it's state isolated from other tests (since it bootstraps Drupal). There is some awkwardness that comes along with this, but what's there seems to work (see the comments for details).

Since this would be the first non-unit PHPUnit test, I added the "@group slow" annotation, so that it can be excluded when you just want the unit tests to run.


Viewing all articles
Browse latest Browse all 300812

Trending Articles