Download & Extend

front page cache added to output if site has caching enabled

Project:SimpleTest
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When using run-tests.sh to test sites that have caching enabled, the HTML of the site's front page gets embedded in the run-tests.sh output.

This appears to be happening because run-tests.sh masquerades as Apache by setting $_SERVER['SERVER_SOFTWARE'] to "Apache" (around line #19):

if ($args['execute-batch']) {
  // Masquerade as Apache for running tests.
  simpletest_script_init("Apache");
  simpletest_script_execute_batch();
}

…while bootstrap.inc outputs the cache unless $_SERVER['SERVER_SOFTWARE'] is set to "PHP CLI":

  if (!$user->uid && $_SERVER['REQUEST_METHOD'] == 'GET' && count(drupal_set_message()) == 0 && $_SERVER['SERVER_SOFTWARE'] !== 'PHP CLI') {
    $cache = cache_get($base_root . request_uri(), 'cache_page');

The extraneous output throws off Jenkins, causing the build to fail. Though I could set $conf = array('cache' => '0'); in the settings.php file, I'd prefer to leave caching enabled, since in the same job I'd like to run Selenium tests that more accurately reflect the current live site.

Alternatively, changing line #21 to simpletest_script_init("PHP CLI"); also seems to fix the problem, but will there be side effects to changing that?

nobody click here