You are here

Allow SimpleTest to test the non-interactive installer

Of course with the testbot we test the installer all the time, but that is one one specific scenario: a browser-based installation with a particular install profile and a particular set of options chosen (e.g., no language imports).

As far as I can tell, this wouldn't even be that hard (famous last words)... the only limitation is that SimpleTest needs to install on an existing site but with a different database prefix, so we may need some small changes to the API to make sure that it allows that (while still preserving security).

This issue would intend to go further by switching the custom simpletest installation code to use the API, which also would allow different installation options besides the profile to be tested. But the other one is a huge step and luckily already RTBC, whereas I would love to get this one in, but personally speaking don't have much time to work on it at the moment, compared to other priorities :(

I've tested this in every way I could think of, via drush si and install.php, with $config_directory_name set in settings.php and without it, with an existing database and without it, with a directory already existing with correct permissions and without them, and with no directory in place.

and

I tried installing Drupal with this patch and a non-writable settings.php file (with database credentials already included in it). The result was that Drupal installed "successfully" but $config_directory_name was still an empty string. So, this needs work.

I would actually go so far as to say this is critical and a bug... since without the ability to test the interactive installer we are shipping with bugs we don't know about...

For example, install Drupal 8 and visit core/install.php again... you'll get the following error:

Fatal error: __clone method called on non-object in /Users/alex/dev/sites/drupal8alt.dev/core/modules/user/user.module on line 722

What's even more fun about this is actually whilst this is what you see on the screen the http status is a 200!!!

In order to enable testing we could move the user agent header check to after bootstrapping Drupal and use drupal_valid_test_ua(). Is the time based check in drupal_valid_test_ua() good enough to protect us?

Patch #1 just contains the change to install.core.inc and adds the new test...
Patch #2 fixes the issue in the user.module in the same way as #1951068: install.php error reporting is broken and shows that we actually have more issues to fix :)

This contains a test for the ability to set the site name during installation as an illustration of how testing the non-interactive installer can work. (Note that if I switched this test to using the standard install profile and additionally searched for "Welcome to [site:name]" on the front page, it would probably reveal a bug since right now in Drupal 8 it seems to be hardcoded to say "Welcome to Drupal" - not sure if there's an issue for that.)

It would be nice to find a way to combine this with #1961938: Test the interactive installer if both eventually happen, since maybe there could be an InstallerTestCase and if you extend that you would just have to provide the installation parameters and write your test once, then the test case itself would be smart enough to run it twice (once with the interactive installer and once with the non-interactive one)?

Note that if I switched this test to using the standard install profile and additionally searched for "Welcome to [site:name]" on the front page, it would probably reveal a bug since right now in Drupal 8 it seems to be hardcoded to say "Welcome to Drupal" - not sure if there's an issue for that.