updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
@@ -17,6 +17,8 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
* Note that the UI strings are not translated because this form is also used
|
||||
* from run-tests.sh.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @see simpletest_script_open_browser()
|
||||
* @see run-tests.sh
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,8 @@ use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Configure simpletest settings for this site.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class SimpletestSettingsForm extends ConfigFormBase {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* List tests arranged in groups that can be selected and run.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class SimpletestTestForm extends FormBase {
|
||||
|
||||
|
||||
@@ -122,6 +122,9 @@ abstract class InstallerTestBase extends WebTestBase {
|
||||
// Select profile.
|
||||
$this->setUpProfile();
|
||||
|
||||
// Address the requirements problem screen, if any.
|
||||
$this->setUpRequirementsProblem();
|
||||
|
||||
// Configure settings.
|
||||
$this->setUpSettings();
|
||||
|
||||
@@ -195,6 +198,23 @@ abstract class InstallerTestBase extends WebTestBase {
|
||||
$this->drupalPostForm(NULL, $edit, $this->translations['Save and continue']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Installer step: Requirements problem.
|
||||
*
|
||||
* Override this method to test specific requirements warnings or errors
|
||||
* during the installer.
|
||||
*
|
||||
* @see system_requirements()
|
||||
*/
|
||||
protected function setUpRequirementsProblem() {
|
||||
// By default, skip the "recommended PHP version" warning on older test
|
||||
// environments. This allows the installer to be tested consistently on
|
||||
// both recommended PHP versions and older (but still supported) versions.
|
||||
if (version_compare(phpversion(), '7.0') < 0) {
|
||||
$this->continueOnExpectedWarnings(['PHP']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Final installer step: Configure site.
|
||||
*/
|
||||
@@ -218,4 +238,44 @@ abstract class InstallerTestBase extends WebTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Continues installation when an expected warning is found.
|
||||
*
|
||||
* @param string[] $expected_warnings
|
||||
* A list of warning summaries to expect on the requirements screen (e.g.
|
||||
* 'PHP', 'PHP OPcode caching', etc.). If only the expected warnings
|
||||
* are found, the test will click the "continue anyway" link to go to the
|
||||
* next screen of the installer. If an expected warning is not found, or if
|
||||
* a warning not in the list is present, a fail is raised.
|
||||
*/
|
||||
protected function continueOnExpectedWarnings($expected_warnings = []) {
|
||||
// Don't try to continue if there are errors.
|
||||
if (strpos($this->getTextContent(), 'Errors found') !== FALSE) {
|
||||
return;
|
||||
}
|
||||
// Allow only details elements that are directly after the warning header
|
||||
// or each other. There is no guaranteed wrapper we can rely on across
|
||||
// distributions. When there are multiple warnings, the selectors will be:
|
||||
// - h3#warning+details summary
|
||||
// - h3#warning+details+details summary
|
||||
// - etc.
|
||||
// We add one more selector than expected warnings to confirm that there
|
||||
// isn't any other warning before clicking the link.
|
||||
// @todo Make this more reliable in
|
||||
// https://www.drupal.org/project/drupal/issues/2927345.
|
||||
$selectors = [];
|
||||
for ($i = 0; $i <= count($expected_warnings); $i++) {
|
||||
$selectors[] = 'h3#warning' . implode('', array_fill(0, $i + 1, '+details')) . ' summary';
|
||||
}
|
||||
$warning_elements = $this->cssSelect(implode(', ', $selectors));
|
||||
|
||||
// Confirm that there are only the expected warnings.
|
||||
$warnings = [];
|
||||
foreach ($warning_elements as $warning) {
|
||||
$warnings[] = trim((string) $warning);
|
||||
}
|
||||
$this->assertEqual($expected_warnings, $warnings);
|
||||
$this->clickLink('continue anyway');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use Drupal\Tests\user\Traits\UserCreationTrait as BaseUserCreationTrait;
|
||||
* \Drupal\simpletest\TestBase.
|
||||
*
|
||||
* @deprecated in Drupal 8.4.x. Will be removed before Drupal 9.0.0. Use
|
||||
* \Drupal\Tests\user\Traits\UserCreationTrait instead.
|
||||
* Drupal\Tests\user\Traits\UserCreationTrait instead.
|
||||
*
|
||||
* @see https://www.drupal.org/node/2884454
|
||||
*/
|
||||
|
||||
@@ -18,6 +18,7 @@ use Drupal\Core\Url;
|
||||
use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait;
|
||||
use Drupal\Tests\EntityViewTrait;
|
||||
use Drupal\Tests\block\Traits\BlockCreationTrait as BaseBlockCreationTrait;
|
||||
use Drupal\Tests\Listeners\DeprecationListenerTrait;
|
||||
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
|
||||
use Drupal\Tests\node\Traits\NodeCreationTrait;
|
||||
use Drupal\Tests\Traits\Core\CronRunTrait;
|
||||
@@ -692,9 +693,21 @@ abstract class WebTestBase extends TestBase {
|
||||
// generated by _drupal_log_error() in the exact form required
|
||||
// by \Drupal\simpletest\WebTestBase::error().
|
||||
if (preg_match('/^X-Drupal-Assertion-[0-9]+: (.*)$/', $header, $matches)) {
|
||||
// Call \Drupal\simpletest\WebTestBase::error() with the parameters from
|
||||
// the header.
|
||||
call_user_func_array([&$this, 'error'], unserialize(urldecode($matches[1])));
|
||||
$parameters = unserialize(urldecode($matches[1]));
|
||||
// Handle deprecation notices triggered by system under test.
|
||||
if ($parameters[1] === 'User deprecated function') {
|
||||
if (getenv('SYMFONY_DEPRECATIONS_HELPER') !== 'disabled') {
|
||||
$message = (string) $parameters[0];
|
||||
if (!in_array($message, DeprecationListenerTrait::getSkippedDeprecations())) {
|
||||
call_user_func_array([&$this, 'error'], $parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Call \Drupal\simpletest\WebTestBase::error() with the parameters from
|
||||
// the header.
|
||||
call_user_func_array([&$this, 'error'], $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
// Save cookies.
|
||||
@@ -819,7 +832,7 @@ abstract class WebTestBase extends TestBase {
|
||||
* The result of the request.
|
||||
*/
|
||||
protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) {
|
||||
$options += ['query' => ['_format' => $format]];
|
||||
$options = array_merge_recursive(['query' => ['_format' => $format]], $options);
|
||||
return $this->drupalGet($path, $options, $headers);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user