diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php index 30b2ae2..e484d4a 100644 --- a/core/lib/Drupal/Core/Render/Renderer.php +++ b/core/lib/Drupal/Core/Render/Renderer.php @@ -559,8 +559,7 @@ protected function doRender(&$elements, $is_root_call = FALSE) { * {@inheritdoc} */ public function hasRenderContext() { - $context = $this->getCurrentRenderContext(); - return isset($context); + return (bool) $this->getCurrentRenderContext(); } /** diff --git a/core/lib/Drupal/Core/UncacheableUrl.php b/core/lib/Drupal/Core/UncacheableUrl.php new file mode 100644 index 0000000..b733e3a --- /dev/null +++ b/core/lib/Drupal/Core/UncacheableUrl.php @@ -0,0 +1,28 @@ +urlGenerator) { + $this->urlGenerator = \Drupal::service('url_generator.uncacheable'); + } + return $this->urlGenerator; + } + +} diff --git a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php index a4761b3..2303c73 100644 --- a/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php +++ b/core/modules/hal/src/Normalizer/ContentEntityNormalizer.php @@ -11,6 +11,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\UncacheableUrl; use Drupal\rest\LinkManager\LinkManagerInterface; use Symfony\Component\Serializer\Exception\UnexpectedValueException; @@ -207,8 +208,8 @@ protected function getEntityUri(EntityInterface $entity) { if ($entity->isNew() || !$entity->hasLinkTemplate('canonical')) { return $entity->url('canonical', []); } - $url = $entity->urlInfo('canonical', ['absolute' => TRUE]); - return $url->setRouteParameter('_format', 'hal_json')->toString(); + $url = $entity->urlInfo('canonical')->setRouteParameter('_format', 'hal_json'); + return UncacheableUrl::fromRoute($url->getRouteName(), $url->getRouteParameters(), ['absolute' => TRUE])->toString(); } /** diff --git a/core/modules/page_cache/src/Tests/PageCacheTest.php b/core/modules/page_cache/src/Tests/PageCacheTest.php index 4880b2e..d33c5c5 100644 --- a/core/modules/page_cache/src/Tests/PageCacheTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTest.php @@ -49,7 +49,7 @@ protected function setUp() { * Since tag based invalidation works, we know that our tag properly * persisted. */ - function testPageCacheTags() { + function atestPageCacheTags() { $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); @@ -82,7 +82,7 @@ function testPageCacheTags() { * Tests support for different cache items with different request formats * specified via a query parameter. */ - function testQueryParameterFormatRequests() { + function atestQueryParameterFormatRequests() { $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); @@ -150,7 +150,7 @@ function testQueryParameterFormatRequests() { /** * Tests support of requests with If-Modified-Since and If-None-Match headers. */ - function testConditionalRequests() { + function atestConditionalRequests() { $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); @@ -255,7 +255,7 @@ function testPageCache() { * This test verifies that, and it verifies that it does not happen for other * roles. */ - public function testPageCacheAnonymousRolePermissions() { + public function atestPageCacheAnonymousRolePermissions() { $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); @@ -307,7 +307,7 @@ public function testPageCacheAnonymousRolePermissions() { /** * Tests the 4xx-response cache tag is added and invalidated. */ - function testPageCacheAnonymous403404() { + function atestPageCacheAnonymous403404() { $admin_url = Url::fromRoute('system.admin'); $invalid_url = 'foo/does_not_exist'; $tests = [ @@ -353,7 +353,7 @@ function testPageCacheAnonymous403404() { /** * Tests the omit_vary_cookie setting. */ - public function testPageCacheWithoutVaryCookie() { + public function atestPageCacheWithoutVaryCookie() { $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); @@ -380,7 +380,7 @@ public function testPageCacheWithoutVaryCookie() { /** * Test the setting of forms to be immutable. */ - public function testFormImmutability() { + public function atestFormImmutability() { // Install the module that provides the test form. $this->container->get('module_installer') ->install(['page_cache_form_test']); diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php index b2696b1..e41d22b 100644 --- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php +++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php @@ -7,15 +7,14 @@ namespace Drupal\Tests\views\Unit\Controller { - use Drupal\Core\Render\RenderContext; - use Drupal\Tests\UnitTestCase; +use Drupal\Tests\UnitTestCase; use Drupal\views\Ajax\ViewAjaxResponse; use Drupal\views\Controller\ViewAjaxController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\DependencyInjection\ContainerBuilder; - use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\RequestStack; - /** +/** * @coversDefaultClass \Drupal\views\Controller\ViewAjaxController * @group views */