This was discussed before, but a clean solution was not found. What we need is a way to install Drupal while it is running using the standard web interface. Without hacking it by placing a detect for simpletest in the installer or the like, I think the only way to do it would be to make a copy of the code in a writeable folder like /sites/default/files (w/e site) and then run the installer out of that directory through the web.

I have the install script that is being used on t.d.o. It doesn't click the links of the first few pages in an attempt to be minimal and have to be changed the least. Part of that is due to the way the minimalist SimpleTest browser was designed. It doesn't work when clicking relative links and such since it assumes they are in the active site as the base url. Which they aren't, they are inside base_url/sites/default/files/something/install.php

  // Install Drupal.
  $d = new DrupalWebTestCase();

  // Step: Select an installation profile.
  // Step: Choose language.
  $d->drupalGet('install.php', array('query' => 'profile=default&locale=en'));

  // Step: Database configuration.
  $edit = array();
  $edit['database'] = $db;
  $edit['username'] = $user;
  $edit['password'] = $pass;
  $edit['db_prefix'] = '';
  $d->drupalPost(NULL, $edit, t('Save and continue'));

  // Step: Site configuration.
  $edit = array();
  $edit['site_name'] = 'checkout';
  $edit['site_mail'] = 'admin@example.com';
  $edit['account[name]'] = 'admin';
  $edit['account[mail]'] = 'admin@example.com';
  $edit['account[pass][pass1]'] = $pass = $d->randomName(12);
  $edit['account[pass][pass2]'] = $pass;
  $edit['clean_url'] = 0;
  $edit['update_status_module[1]'] = FALSE;
  $d->drupalPost(NULL, $edit, t('Save and continue'));

It should be able to just install itself in a prefixed directory like SimpleTest normally does, but it needs to remove the copied code afterwards so that it always copies the latest version of itself.

Comments

boombatower’s picture

If this can be done then I can modify t.d.o to use it and it can be maintained like a test. Meaning changes to the installer won't hose t.d.o.

I already had to update the SimpleTest browser with the meta refresh patch which allows SimpleTest to run batch API pages.

cyberswat’s picture

subscribing

boombatower’s picture

One thought, should we make this a test or more of an automatic installation script and put it with the other scripts?

boombatower’s picture

This could be made a test if we required a vhost setup with apache...or put some code atop index.php, update.php, and install.php that would switch the HTTP_HOST value when given specified parameters (although that could be dangerous).

boombatower’s picture

Assigned: Unassigned » boombatower

Forgot to set status: I have started (hour ago).

boombatower’s picture

Title: Create auto-install script » Find a way to put a test for the installer in SimpleTest
StatusFileSize
new4.44 KB

Going the route of auto-install script which is much more feasible (for numerous technical reasons) and possibly more useful.

Initial pass...doesn't work at all. (got side tracked with: #345632: SimpleTest: correct assertTitle logic)

Currently it does on:

require_once drupal_get_path('module', 'simpletest') . '/drupal_web_test_case.php';

drupal_get_path() apparently returns ''.

Might be due to this when bootstrapping:

PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 1124
PHP Warning:  session_start(): Cannot send session cache limiter - headers already sent (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 1124
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 717
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 718
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 719
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/jimmy/software/php/drupal-7/scripts/auto-install.php:85) in /home/jimmy/software/php/drupal-7/includes/bootstrap.inc on line 720
PHP Notice:  Undefined index:  garland in /home/jimmy/software/php/drupal-7/includes/theme.inc on line 72
PHP Notice:  Trying to get property of non-object in /home/jimmy/software/php/drupal-7/includes/theme.inc on line 105
PHP Notice:  Trying to get property of non-object in /home/jimmy/software/php/drupal-7/includes/theme.inc on line 237

Thoughts?

boombatower’s picture

Title: Find a way to put a test for the installer in SimpleTest » Create auto-install script
Component: simpletest.module » base system
boombatower’s picture

Title: Find a way to put a test for the installer in SimpleTest » Create auto-install script

Just needed:

chdir(DRUPAL_ROOT);
boombatower’s picture

Status: Active » Postponed
StatusFileSize
new4.7 KB

Updated script. This will require a bit of tweaking since DrupalWebTestCase now uses protected modifiers.

Postponing until: #340283: Abstract SimpleTest browser in to its own object

adrian’s picture

we have an install script for Aegir.

It creates a drush command called 'provision install', and creates a mysql database and virtual host entry of the site for you.

we will also be plugging into unit testing in the future.

boombatower’s picture

Core needs one in order for testing.drupal.org to function properly all the time.

josh waihi’s picture

have you thought about simpletest implementing install tests. Then these tests could be called to install drupal. This would also take a step out of the PIFR process and merge it into the runningof the tests.

boombatower’s picture

We ran into a number of problems with that. One being SimpleTest would need to have virtual hosts setup or something in order to allow it to run the installer...since the current code base it is running on is already installed....it is also A LOT more useful as a script.

This is extremely easy to do once someone (or me when I get time) finishes the abstract browser patch which is also useful in its own right. Making a test has a number of technical issues as webchick and I discussed in IRC a long time ago...and is not as useful of a solution.

dave reid’s picture

I have a few patches that change the installer that are doomed to stay CNW until this lands. :)

boombatower’s picture

Status: Postponed » Closed (duplicate)