summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc22
1 files changed, 18 insertions, 4 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 021e1a47d..ce0839021 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5230,8 +5230,6 @@ function drupal_cron_cleanup() {
function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
$config = conf_path();
- $profile = drupal_get_profile();
-
$searchdir = array($directory);
$files = array();
@@ -5239,8 +5237,24 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)
// themes as organized by a distribution. It is pristine in the same way
// that /modules is pristine for core; users should avoid changing anything
// there in favor of sites/all or sites/<domain> directories.
- if (file_exists("profiles/$profile/$directory")) {
- $searchdir[] = "profiles/$profile/$directory";
+ $profiles = array();
+ $profile = drupal_get_profile();
+ // For SimpleTest to be able to test modules packaged together with a
+ // distribution we need to include the profile of the parent site (in which
+ // test runs are triggered).
+ if (drupal_valid_test_ua()) {
+ $testing_profile = variable_get('simpletest_parent_profile', FALSE);
+ if ($testing_profile && $testing_profile != $profile) {
+ $profiles[] = $testing_profile;
+ }
+ }
+ // In case both profile directories contain the same extension, the actual
+ // profile always has precedence.
+ $profiles[] = $profile;
+ foreach ($profiles as $profile) {
+ if (file_exists("profiles/$profile/$directory")) {
+ $searchdir[] = "profiles/$profile/$directory";
+ }
}
// Always search sites/all/* as well as the global directories.