Skip to content
Snippets Groups Projects
Commit 28f177cd authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 242ac392
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -193,8 +193,10 @@ function drupal_get_region_content($region = NULL, $delimiter = ' ') { ...@@ -193,8 +193,10 @@ function drupal_get_region_content($region = NULL, $delimiter = ' ') {
* installation state. At all other times, the "install_profile" setting will be * installation state. At all other times, the "install_profile" setting will be
* available in settings.php. * available in settings.php.
* *
* @return $profile * @return string|null $profile
* The name of the installation 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() { function drupal_get_profile() {
global $install_state; global $install_state;
...@@ -205,11 +207,12 @@ function drupal_get_profile() { ...@@ -205,11 +207,12 @@ function drupal_get_profile() {
$profile = $install_state['parameters']['profile']; $profile = $install_state['parameters']['profile'];
} }
else { else {
$profile = ''; $profile = NULL;
} }
} }
else { 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; return $profile;
......
...@@ -266,4 +266,14 @@ function testEnableModulesTheme() { ...@@ -266,4 +266,14 @@ function testEnableModulesTheme() {
$this->assertTrue(drupal_render($element)); $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());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment