diff --cc core/modules/simpletest/src/WebTestBase.php index 50f9533,32e6e5e..0000000 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@@ -11,13 -10,19 +11,15 @@@ use Drupal\block\Entity\Block use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Serialization\Json; use Drupal\Component\Serialization\Yaml; -use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\Html; use Drupal\Component\Utility\NestedArray; - use Drupal\Component\Utility\SafeMarkup; + use Drupal\Component\Utility\UrlHelper; use Drupal\Core\Cache\Cache; + use Drupal\Component\Utility\SafeMarkup; -use Drupal\Core\DependencyInjection\YamlFileLoader; -use Drupal\Core\DrupalKernel; use Drupal\Core\Database\Database; -use Drupal\Core\Database\ConnectionNotDefinedException; +use Drupal\Core\DrupalKernel; use Drupal\Core\Entity\EntityInterface; + use Drupal\Core\EventSubscriber\MainContentViewSubscriber; -use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Render\Element; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AnonymousUserSession; @@@ -1699,8 -1843,21 +1708,26 @@@ abstract class WebTestBase extends Test // Unless a particular path is specified, use the one specified by the // Ajax settings, or else 'system/ajax'. if (!isset($ajax_path)) { - $ajax_path = isset($ajax_settings['url']) ? $ajax_settings['url'] : 'system/ajax'; + if (isset($ajax_settings['url'])) { ++ // In order to allow to set for example the wrapper envelope query ++ // parameter we need to get the system path again. + $parsed_url = UrlHelper::parse($ajax_settings['url']); + $options['query'] = $parsed_url['query'] + $options['query']; + $options += ['fragment' => $parsed_url['fragment']]; ++ ++ // We know that $parsed_url['path'] is already with the base path ++ // attached. + $ajax_path = preg_replace( - '/^' . preg_quote($GLOBALS['base_path'], '/') . '/', ++ '/^' . preg_quote(base_path(), '/') . '/', + '', + $parsed_url['path'] + ); + } + else { + $ajax_path = 'system/ajax'; + } } + $ajax_path = $this->container->get('unrouted_url_assembler')->assemble('base://' . $ajax_path, $options); // Submit the POST request. $return = Json::decode($this->drupalPostForm(NULL, $edit, array('path' => $ajax_path, 'triggering_element' => $triggering_element), $options, $headers, $form_html_id, $extra_post)); diff --git a/core/lib/Drupal/Core/ContentNegotiation.php b/core/lib/Drupal/Core/ContentNegotiation.php index 3322af8..e45c92d 100644 --- a/core/lib/Drupal/Core/ContentNegotiation.php +++ b/core/lib/Drupal/Core/ContentNegotiation.php @@ -38,10 +38,9 @@ public function getContentType(Request $request) { // Check all formats, if priority format is found return it. $first_found_format = FALSE; - $priority = array('html'); foreach ($request->getAcceptableContentTypes() as $mime_type) { $format = $request->getFormat($mime_type); - if (in_array($format, $priority, TRUE)) { + if ($format === 'html') { return $format; } if (!is_null($format) && !$first_found_format) {