Change record status: 
Project: 
Introduced in branch: 
10.0.x
Introduced in version: 
10.0.0
Description: 

Before branch 10.0.x we used to have a require_once __DIR__ . '/../../../../includes/install.inc' on the following classes:

  • core/tests/Drupal/KernelTests/KernelTestBase.php
  • core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php

This code allows the kernel tests and update path tests to use the procedural functions from install.inc. After release 10.0.0, the procedural functions will not be available anymore.

If you use any procedural functions from install.inc inside of your KernelTests and UpdatePathTest, you'll need to require the install.inc before using the function.

Before change


namespace Drupal\contrib_module;

use Drupal\KernelTests\KernelTestBase;

/**
 * Example kernel test.
 */
class ExampleTest extends KernelTestBase {

  public function testFunction() {
    // Call procedure function from install.inc
    $databases = drupal_detect_database_types();
  }

}

After the change


namespace Drupal\contrib_module;

use Drupal\KernelTests\KernelTestBase;

/**
 * Example kernel test.
 */
class ExampleTest extends KernelTestBase {

  public function testFunction() {
    // Before use the procedure function, require install.inc.
    // Please check the correct path for install.
    require_once '/includes/install.inc';

    // Call procedure function from install.inc
    $databases = drupal_detect_database_types();
  }

}

The following function are located in includes/install.inc:

  • drupal_load_updates()
  • drupal_install_profile_distribution_name()
  • drupal_install_profile_distribution_version()
  • drupal_detect_database_types()
  • _drupal_rewrite_settings_is_simple()
  • _drupal_rewrite_settings_is_array_index()
  • _drupal_rewrite_settings_global()
  • _drupal_rewrite_settings_dump()
  • _drupal_rewrite_settings_dump_one()
  • drupal_verify_profile()
  • drupal_install_system()
  • drupal_verify_install_file()
  • drupal_install_mkdir()
  • drupal_install_fix_file()
  • install_goto()
  • drupal_current_script_url()
  • drupal_requirements_url()
  • drupal_check_profile()
  • drupal_requirements_severity()
  • drupal_check_module()
  • install_profile_info()
  • db_installer_object()

There are also a number of constants in the file /includes/install.inc:

  • REQUIREMENT_INFO
  • REQUIREMENT_OK
  • REQUIREMENT_WARNING
  • REQUIREMENT_ERROR
  • FILE_EXIST
  • FILE_READABLE
  • FILE_WRITABLE
  • FILE_EXECUTABLE
  • FILE_NOT_EXIST
  • FILE_NOT_READABLE
  • FILE_NOT_WRITABLE
  • FILE_NOT_EXECUTABLE
Impacts: 
Module developers