Like a good little developer, I've written automated tests for my modules and distributions using the Simpletest framework. They have saved me from releasing defective code on one or two occasions. Lately, however, it's become increasingly complicated to get those tests to run on my BOA Aegir Vagrant dev environment. So, I'm writing these notes to remind myself what to do.
tl;dr: Disable open_basedir for PHP and turn off Redis and Speed Booster caching.
Disable open_basedir in php.ini files
The "Testing" module in Drupal won't even let you install it unless you've disabled open_basedir in php. The php.ini files have been moved around several times in BOA Aegir, but you can find them with drush php-eval "phpinfo();" | grep ini
. That should give you something like this:
Configuration File (php.ini) Path => /opt/php53/lib
Loaded Configuration File => /data/disk/o1/.drush/php.ini
[etc.]
The web server and drush use different configuration files for php. The web server, in BOA 2.3.3 at least, uses /opt/php53/etc/php53.ini, so that's pretty close to /opt/php53/lib. If you need to find the exact file, just create a blank php page in one of your sites with the line <?php phpinfo();
and visit that file in your browser.
Drush uses the file mentioned in the second line.
Check each of these files for a line beginning with open_basedir
and comment it out. You will have to be root to do this
(sudo su -
)
and you may have to change the immutable attribute on the .drush/php.ini file
(chattr -i /data/disk/o1/.drush/php.ini
)
then you can use your favorite editor on the files or justsed -i "s/^open_basedir/;open_basedir/g"
the file.
Disable Redis and Speed Booster caching
Recent versions of BOA Aegir allow you to turn off caching on a per-site or per-platform basis. You must do this for the sites that you're using to run simpletests.
- Un-comment and set the line
redis_cache_disable = TRUE
in the file at sites/[site]/modules/boa_site_control.ini. - Add the single line
header('X-Accel-Expires: 0');
to the site's local.settings.php file.