Commit a5929f56 authored by catch's avatar catch
Browse files

Issue #3300773 by bradjones1, andypost: Fix failed test on...

Issue #3300773 by bradjones1, andypost: Fix failed test on `symfony/http-foundation` 4.4.44/6.1.3 and later
parent b3af2575
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@
            "dist": {
                "type": "path",
                "url": "core",
                "reference": "24e68923f64073d860bf08e6c0e412614ed40703"
                "reference": "c3581356272302fa1757a8881289fd8e05c8ca07"
            },
            "require": {
                "asm89/stack-cors": "^2.0.2",
@@ -470,7 +470,7 @@
                "symfony/console": "^6.1",
                "symfony/dependency-injection": "^6.1",
                "symfony/event-dispatcher": "^6.1",
                "symfony/http-foundation": "^6.1.1",
                "symfony/http-foundation": "^6.1.3",
                "symfony/http-kernel": "^6.1",
                "symfony/mime": "^6.1",
                "symfony/polyfill-iconv": "^1.25",
@@ -2216,16 +2216,16 @@
        },
        {
            "name": "symfony/http-foundation",
            "version": "v6.1.2",
            "version": "v6.1.3",
            "source": {
                "type": "git",
                "url": "https://github.com/symfony/http-foundation.git",
                "reference": "86119d294e51afe4d8e07da96b63332bd1f3f52c"
                "reference": "b03712c93759a81fc243ecc18ec4637958afebdb"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/86119d294e51afe4d8e07da96b63332bd1f3f52c",
                "reference": "86119d294e51afe4d8e07da96b63332bd1f3f52c",
                "url": "https://api.github.com/repos/symfony/http-foundation/zipball/b03712c93759a81fc243ecc18ec4637958afebdb",
                "reference": "b03712c93759a81fc243ecc18ec4637958afebdb",
                "shasum": ""
            },
            "require": {
@@ -2268,7 +2268,7 @@
            "description": "Defines an object-oriented layer for the HTTP specification",
            "homepage": "https://symfony.com",
            "support": {
                "source": "https://github.com/symfony/http-foundation/tree/v6.1.2"
                "source": "https://github.com/symfony/http-foundation/tree/v6.1.3"
            },
            "funding": [
                {
@@ -2284,7 +2284,7 @@
                    "type": "tidelift"
                }
            ],
            "time": "2022-06-19T13:21:48+00:00"
            "time": "2022-07-27T15:50:51+00:00"
        },
        {
            "name": "symfony/http-kernel",
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
        "symfony/error-handler": "~v6.1.0",
        "symfony/event-dispatcher": "~v6.1.0",
        "symfony/event-dispatcher-contracts": "~v3.1.0",
        "symfony/http-foundation": "~v6.1.2",
        "symfony/http-foundation": "~v6.1.3",
        "symfony/http-kernel": "~v6.1.2",
        "symfony/mime": "~v6.1.1",
        "symfony/polyfill-ctype": "~v1.26.0",
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
        "symfony/console": "^6.1",
        "symfony/dependency-injection": "^6.1",
        "symfony/event-dispatcher": "^6.1",
        "symfony/http-foundation": "^6.1.1",
        "symfony/http-foundation": "^6.1.3",
        "symfony/http-kernel": "^6.1",
        "symfony/mime": "^6.1",
        "symfony/routing": "^6.1",
+3 −1
Original line number Diff line number Diff line
@@ -15,12 +15,14 @@
 */
class TestControllers {

  const LONG_TEXT = 'This is text long enough to trigger Apache mod_deflate to add a `vary: accept-encoding` header to the response.';

  public function test() {
    return new Response('test');
  }

  public function test1() {
    return new Response('test1');
    return new Response(self::LONG_TEXT);
  }

  public function test2() {
+5 −2
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Language\LanguageInterface;
use Drupal\router_test\TestControllers;
use Drupal\Tests\BrowserTestBase;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Drupal\Core\Url;
@@ -38,14 +39,16 @@ public function testFinishResponseSubscriber() {

    // Confirm that the router can get to a controller.
    $this->drupalGet('router_test/test1');
    $this->assertSession()->pageTextContains('test1');
    $this->assertSession()->pageTextContains(TestControllers::LONG_TEXT);
    $session = $this->getSession();

    // Check expected headers from FinishResponseSubscriber.
    $this->assertSession()->responseHeaderEquals('Content-language', 'en');
    $this->assertSession()->responseHeaderEquals('X-Content-Type-Options', 'nosniff');
    $this->assertSession()->responseHeaderEquals('X-Frame-Options', 'SAMEORIGIN');
    if (strcasecmp($session->getResponseHeader('vary'), 'accept-encoding') !== 0) {
      $this->assertSession()->responseHeaderDoesNotExist('Vary');
    }

    $this->drupalGet('router_test/test2');
    $this->assertSession()->pageTextContains('test2');