Commit 28f177cd authored by webchick's avatar webchick

Issue #2234771 by tstoeckler: Drupal_get_profile() should not fall back to 'standard'.

parent 242ac392
......@@ -193,8 +193,10 @@ function drupal_get_region_content($region = NULL, $delimiter = ' ') {
* installation state. At all other times, the "install_profile" setting will be
* available in settings.php.
*
* @return $profile
* The name of the installation profile.
* @return string|null $profile
* The name of the installation profile or NULL if no installation profile is
* currently active. This is the case for example during the first steps of
* the installer or during unit tests.
*/
function drupal_get_profile() {
global $install_state;
......@@ -205,11 +207,12 @@ function drupal_get_profile() {
$profile = $install_state['parameters']['profile'];
}
else {
$profile = '';
$profile = NULL;
}
}
else {
$profile = Settings::get('install_profile') ?: 'standard';
// Fall back to NULL, if there is no 'install_profile' setting.
$profile = Settings::get('install_profile');
}
return $profile;
......
......@@ -266,4 +266,14 @@ function testEnableModulesTheme() {
$this->assertTrue(drupal_render($element));
}
/**
* Tests that drupal_get_profile() returns NULL.
*
* As the currently active installation profile is used when installing
* configuration, for example, this is essential to ensure test isolation.
*/
public function testDrupalGetProfile() {
$this->assertNull(drupal_get_profile());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment