function BrowserTestBase::translatePostValues
Same name in other branches
- 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::translatePostValues()
- 10 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::translatePostValues()
- 11.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::translatePostValues()
Transforms a nested array into a flat array suitable for drupalPostForm().
Parameters
array $values: A multi-dimensional form values array to convert.
Return value
array The flattened $edit array suitable for BrowserTestBase::drupalPostForm().
9 calls to BrowserTestBase::translatePostValues()
- IdConflictTest::testMigrateUpgradeExecute in core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ d6/ IdConflictTest.php - Tests ID Conflict form.
- IdConflictTest::testMigrateUpgradeExecute in core/
modules/ migrate_drupal_ui/ tests/ src/ Functional/ d7/ IdConflictTest.php - Tests ID Conflict form.
- InstallerExistingDatabaseSettingsTest::setUpSettings in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerExistingDatabaseSettingsTest.php - @todo The database settings form is not supposed to appear if settings.php contains a valid database connection already (but e.g. no config directories yet).
- InstallerNonDefaultDatabaseDriverTest::setUpSettings in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerNonDefaultDatabaseDriverTest.php - Installer step: Configure settings.
- InstallerTestBase::setUpSettings in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerTestBase.php - Installer step: Configure settings.
File
-
core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 749
Class
- BrowserTestBase
- Provides a test case for functional Drupal tests.
Namespace
Drupal\TestsCode
protected function translatePostValues(array $values) {
$edit = [];
// The easiest and most straightforward way to translate values suitable for
// BrowserTestBase::drupalPostForm() is to actually build the POST data
// string and convert the resulting key/value pairs back into a flat array.
$query = http_build_query($values);
foreach (explode('&', $query) as $item) {
list($key, $value) = explode('=', $item);
$edit[urldecode($key)] = urldecode($value);
}
return $edit;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.