You are here

protected function WebTestBase::installParameters in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::installParameters()

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

Return value

array Array of parameters for use in install_drupal().

See also

install_drupal()

install_state_defaults()

4 calls to WebTestBase::installParameters()
InstallerTestBase::setUp in core/modules/simpletest/src/InstallerTestBase.php
Sets up a Drupal site for running functional and integration tests.
NodeTypeTranslationTest::installParameters in core/modules/node/src/Tests/NodeTypeTranslationTest.php
Install Drupal in a language other than English for this test. This is not needed to test the node type translation itself but acts as a regression test.
SiteNameTest::installParameters in core/modules/system/src/Tests/Installer/SiteNameTest.php
Returns the parameters that will be used when Simpletest installs Drupal.
WebTestBase::doInstall in core/modules/simpletest/src/WebTestBase.php
Execute the non-interactive installer.
2 methods override WebTestBase::installParameters()
NodeTypeTranslationTest::installParameters in core/modules/node/src/Tests/NodeTypeTranslationTest.php
Install Drupal in a language other than English for this test. This is not needed to test the node type translation itself but acts as a regression test.
SiteNameTest::installParameters in core/modules/system/src/Tests/Installer/SiteNameTest.php
Returns the parameters that will be used when Simpletest installs Drupal.

File

core/modules/simpletest/src/WebTestBase.php, line 893
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function installParameters() {
  $connection_info = Database::getConnectionInfo();
  $driver = $connection_info['default']['driver'];
  $connection_info['default']['prefix'] = $connection_info['default']['prefix']['default'];
  unset($connection_info['default']['driver']);
  unset($connection_info['default']['namespace']);
  unset($connection_info['default']['pdo']);
  unset($connection_info['default']['init_commands']);

  // Remove database connection info that is not used by SQLite.
  if ($driver == 'sqlite') {
    unset($connection_info['default']['username']);
    unset($connection_info['default']['password']);
    unset($connection_info['default']['host']);
    unset($connection_info['default']['port']);
  }
  $parameters = array(
    'interactive' => FALSE,
    'parameters' => array(
      'profile' => $this->profile,
      'langcode' => 'en',
    ),
    'forms' => array(
      'install_settings_form' => array(
        'driver' => $driver,
        $driver => $connection_info['default'],
      ),
      'install_configure_form' => array(
        'site_name' => 'Drupal',
        'site_mail' => 'simpletest@example.com',
        'account' => array(
          'name' => $this->rootUser->name,
          'mail' => $this->rootUser
            ->getEmail(),
          'pass' => array(
            'pass1' => $this->rootUser->pass_raw,
            'pass2' => $this->rootUser->pass_raw,
          ),
        ),
        // \Drupal\Core\Render\Element\Checkboxes::valueCallback() requires
        // NULL instead of FALSE values for programmatic form submissions to
        // disable a checkbox.
        'update_status_module' => array(
          1 => NULL,
          2 => NULL,
        ),
      ),
    ),
  );

  // If we only have one db driver available, we cannot set the driver.
  include_once DRUPAL_ROOT . '/core/includes/install.inc';
  if (count($this
    ->getDatabaseTypes()) == 1) {
    unset($parameters['forms']['install_settings_form']['driver']);
  }
  return $parameters;
}