function FunctionalTestSetupTrait::installParameters

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::installParameters()
  2. 8.9.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::installParameters()
  3. 11.x core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php \Drupal\Core\Test\FunctionalTestSetupTrait::installParameters()

Returns the parameters that will be used when the test installs Drupal.

Return value

array Array of parameters for use in install_drupal().

See also

install_drupal()

install_state_defaults()

3 calls to FunctionalTestSetupTrait::installParameters()
FunctionalTestSetupTrait::doInstall in core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
Execute the non-interactive installer.
InstallerDeprecatedDriverNameTest::doInstall in core/tests/Drupal/FunctionalTests/Installer/InstallerDeprecatedDriverNameTest.php
Execute the non-interactive installer.
TestSiteInstallCommand::installParameters in core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php
8 methods override FunctionalTestSetupTrait::installParameters()
DemoUmamiProfileTest::installParameters in core/profiles/demo_umami/tests/src/Functional/DemoUmamiProfileTest.php
Returns the parameters that will be used when the test installs Drupal.
HelpTopicTranslatedTestBase::installParameters in core/modules/help/tests/src/Functional/HelpTopicTranslatedTestBase.php
Returns the parameters that will be used when the test installs Drupal.
InstallerTestBase::installParameters in core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
Returns the parameters that will be used when the test installs Drupal.
InstallerTranslationMultipleLanguageNonInteractiveTest::installParameters in core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
Returns the parameters that will be used when the test installs Drupal.
LocaleNonInteractiveInstallTest::installParameters in core/modules/locale/tests/src/Functional/LocaleNonInteractiveInstallTest.php
Returns the parameters that will be used when the test installs Drupal.

... See full list

File

core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php, line 540

Class

FunctionalTestSetupTrait
Defines a trait for shared functional test setup functionality.

Namespace

Drupal\Core\Test

Code

protected function installParameters() {
    $formInput = Database::getConnectionInfo()['default'];
    $driverName = $formInput['driver'];
    $driverNamespace = $formInput['namespace'];
    unset($formInput['driver']);
    unset($formInput['namespace']);
    unset($formInput['autoload']);
    unset($formInput['pdo']);
    unset($formInput['init_commands']);
    unset($formInput['isolation_level']);
    // Remove database connection info that is not used by SQLite.
    if ($driverName === "sqlite") {
        unset($formInput['username']);
        unset($formInput['password']);
        unset($formInput['host']);
        unset($formInput['port']);
    }
    $parameters = [
        'interactive' => FALSE,
        'parameters' => [
            'profile' => $this->profile,
            'langcode' => 'en',
        ],
        'forms' => [
            'install_settings_form' => [
                'driver' => $driverNamespace,
                $driverNamespace => $formInput,
            ],
            'install_configure_form' => [
                'site_name' => 'Drupal',
                'site_mail' => 'simpletest@example.com',
                'account' => [
                    'name' => $this->rootUser->name,
                    'mail' => $this->rootUser
                        ->getEmail(),
                    'pass' => [
                        'pass1' => $this->rootUser->pass_raw ?? $this->rootUser->passRaw,
                        'pass2' => $this->rootUser->pass_raw ?? $this->rootUser->passRaw,
                    ],
                ],
                // \Drupal\Core\Render\Element\Checkboxes::valueCallback() requires
                // NULL instead of FALSE values for programmatic form submissions to
                // disable a checkbox.
'enable_update_status_module' => NULL,
                'enable_update_status_emails' => NULL,
            ],
        ],
    ];
    // If we only have one db driver available, we cannot set the driver.
    if (count($this->getDatabaseTypes()) == 1) {
        unset($parameters['forms']['install_settings_form']['driver']);
    }
    return $parameters;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.