Loading core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; $settings_file = './' . $this->sitePath . '/settings.php'; $form['#title'] = $this->t('Database configuration'); Loading Loading @@ -155,6 +157,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; $driver = $form_state->getValue('driver'); $database = $form_state->getValue($driver); $drivers = drupal_get_database_types(); Loading Loading @@ -236,6 +241,9 @@ public static function getDatabaseErrorsTemplate(array $errors) { public function submitForm(array &$form, FormStateInterface $form_state) { global $install_state; // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; // Update global settings array and save. $settings = []; $database = $form_state->get('database'); Loading core/modules/system/tests/modules/install_form_test/install_form_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: Install Form Test type: module description: Test the SiteSettingsForm can be extended. package: Testing version: VERSION core/modules/system/tests/modules/install_form_test/install_form_test.routing.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line install_form_test.test-form: path: /test-form defaults: _form: \Drupal\install_form_test\Form\ExtendedForm _title: Extended Site Settings Form requirements: _access: 'TRUE' core/modules/system/tests/modules/install_form_test/src/Form/ExtendedForm.php 0 → 100644 +11 −0 Original line number Diff line number Diff line <?php namespace Drupal\install_form_test\Form; use Drupal\Core\Installer\Form\SiteSettingsForm; /** * Extends the site setting form. */ class ExtendedForm extends SiteSettingsForm { } core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php namespace Drupal\FunctionalTests\Installer; use Drupal\Tests\BrowserTestBase; /** * Tests the extension of the site settings form. * * @group Installer */ class SiteSettingsFormTest extends BrowserTestBase { /** * {@inheritdoc} */ protected static $modules = ['install_form_test']; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Confirms that the form is extensible. */ public function testSiteSettingsForm() { // Test that the form page can be loaded without errors. $this->drupalGet('test-form'); $this->assertSession()->statusCodeEquals(200); } } Loading
core/lib/Drupal/Core/Installer/Form/SiteSettingsForm.php +8 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,8 @@ public function getFormId() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; $settings_file = './' . $this->sitePath . '/settings.php'; $form['#title'] = $this->t('Database configuration'); Loading Loading @@ -155,6 +157,9 @@ public function buildForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; $driver = $form_state->getValue('driver'); $database = $form_state->getValue($driver); $drivers = drupal_get_database_types(); Loading Loading @@ -236,6 +241,9 @@ public static function getDatabaseErrorsTemplate(array $errors) { public function submitForm(array &$form, FormStateInterface $form_state) { global $install_state; // Make sure the install API is available. include_once DRUPAL_ROOT . '/core/includes/install.inc'; // Update global settings array and save. $settings = []; $database = $form_state->get('database'); Loading
core/modules/system/tests/modules/install_form_test/install_form_test.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: Install Form Test type: module description: Test the SiteSettingsForm can be extended. package: Testing version: VERSION
core/modules/system/tests/modules/install_form_test/install_form_test.routing.yml 0 → 100644 +7 −0 Original line number Diff line number Diff line install_form_test.test-form: path: /test-form defaults: _form: \Drupal\install_form_test\Form\ExtendedForm _title: Extended Site Settings Form requirements: _access: 'TRUE'
core/modules/system/tests/modules/install_form_test/src/Form/ExtendedForm.php 0 → 100644 +11 −0 Original line number Diff line number Diff line <?php namespace Drupal\install_form_test\Form; use Drupal\Core\Installer\Form\SiteSettingsForm; /** * Extends the site setting form. */ class ExtendedForm extends SiteSettingsForm { }
core/tests/Drupal/FunctionalTests/Installer/SiteSettingsFormTest.php 0 → 100644 +33 −0 Original line number Diff line number Diff line <?php namespace Drupal\FunctionalTests\Installer; use Drupal\Tests\BrowserTestBase; /** * Tests the extension of the site settings form. * * @group Installer */ class SiteSettingsFormTest extends BrowserTestBase { /** * {@inheritdoc} */ protected static $modules = ['install_form_test']; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; /** * Confirms that the form is extensible. */ public function testSiteSettingsForm() { // Test that the form page can be loaded without errors. $this->drupalGet('test-form'); $this->assertSession()->statusCodeEquals(200); } }