Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
Local patch for #2992274 Installer tests fail if contrib driver hides…
Browse files Browse the repository at this point in the history
… database credentials form fields (#319)
  • Loading branch information
mondrake authored Mar 30, 2023
1 parent de50e82 commit 2067eba
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
php-version:
- "8.1"
test-args:
- "--group Database"
# - "--group Database"
# - "--group Entity"
# - "--group Cache,Config"
- "--group Cache,Config"
# - "--group field,Field"
# - "--group file"
# - "--group views"
Expand Down
38 changes: 38 additions & 0 deletions tests/github/2992274-local.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
index 7ded3eec27..851b0343fb 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTestBase.php
@@ -10,6 +10,7 @@
use Drupal\Core\Utility\PhpRequirements;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\RequirementsPageTrait;
+use Behat\Mink\Exception\ElementNotFoundException;
use GuzzleHttp\HandlerStack;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -258,8 +259,23 @@ protected function setUpSettings() {
$parameters = $this->parameters['forms']['install_settings_form'];
$driver = $parameters['driver'];
unset($parameters[$driver]['dependencies']);
- $edit = $this->translatePostValues($parameters);
- $this->submitForm($edit, $this->translations['Save and continue']);
+
+ $form_values_to_submit = $this->translatePostValues($parameters);
+
+ // Ensure that the fields to be edited actually exist on the form.
+ $assert_session = $this->assertSession();
+ $form_values = [];
+ foreach ($form_values_to_submit as $name => $value) {
+ try {
+ $field = $assert_session->fieldExists($name);
+ $form_values[$name] = $value;
+ }
+ catch (ElementNotFoundException $e) {
+ continue;
+ }
+ }
+
+ $this->submitForm($form_values, $this->translations['Save and continue']);
}

/**
7 changes: 4 additions & 3 deletions tests/github/drupal_patch.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/sh -e

#2992274 Installer tests fail if contrib driver hides database credentials form fields
# curl https://www.drupal.org/files/issues/2022-06-01/2992274-25.patch | git apply -v

#3110546 Allow contributed modules (mostly database drivers) to override tests in core
curl https://git.drupalcode.org/project/drupal/-/merge_requests/291.diff | git apply -v

#3256642 Introduce database driver extensions and autoload database drivers' dependencies
curl https://git.drupalcode.org/project/drupal/-/merge_requests/3169.diff | git apply -v

#2992274 Installer tests fail if contrib driver hides database credentials form fields
# curl https://www.drupal.org/files/issues/2022-06-01/2992274-25.patch | git apply -v
git apply -v ./drudbal_staging/tests/github/2992274-local.patch

#3347497 Introduce a FetchModeTrait to allow emulating PDO fetch modes
curl https://git.drupalcode.org/project/drupal/-/merge_requests/3676.diff | git apply -v

0 comments on commit 2067eba

Please sign in to comment.