Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FriendsOfSymfony/FOSHttpCache
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.16.2
Choose a base ref
...
head repository: FriendsOfSymfony/FOSHttpCache
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.x
Choose a head ref
Loading
Showing with 1,485 additions and 2,639 deletions.
  1. +83 −62 .github/workflows/ci.yml
  2. +0 −5 .github/workflows/spellcheck.yml
  3. +8 −21 .github/workflows/static.yml
  4. +0 −22 .phpstan/classAliases.php
  5. +34 −0 CHANGELOG.md
  6. +15 −14 composer.json
  7. +1 −1 doc/Makefile
  8. +1 −1 doc/fastly-configuration.rst
  9. +3 −3 doc/index.rst
  10. +5 −19 doc/installation.rst
  11. +3 −4 doc/proxy-clients.rst
  12. +1 −0 doc/requirements.txt
  13. +3 −8 doc/symfony-cache-configuration.rst
  14. +9 −15 doc/testing-your-application.rst
  15. +1 −1 doc/varnish-configuration.rst
  16. +4 −10 phpstan.neon.dist
  17. +0 −6 phpstan.tests.neon.dist
  18. +24 −24 phpunit.xml.dist
  19. +34 −59 src/CacheInvalidator.php
  20. +3 −11 src/Event.php
  21. +9 −14 src/EventListener/LogListener.php
  22. +13 −18 src/Exception/ExceptionCollection.php
  23. +6 −10 src/Exception/InvalidUrlException.php
  24. +1 −3 src/Exception/MissingHostException.php
  25. +1 −4 src/Exception/ProxyResponseException.php
  26. +1 −4 src/Exception/ProxyUnreachableException.php
  27. +1 −3 src/Exception/UnsupportedProxyOperationException.php
  28. +23 −28 src/ProxyClient/Cloudflare.php
  29. +5 −6 src/ProxyClient/Dispatcher.php
  30. +17 −11 src/ProxyClient/Fastly.php
  31. +33 −54 src/ProxyClient/HttpDispatcher.php
  32. +40 −40 src/ProxyClient/HttpProxyClient.php
  33. +9 −13 src/ProxyClient/Invalidation/BanCapable.php
  34. +1 −3 src/ProxyClient/Invalidation/ClearCapable.php
  35. +4 −6 src/ProxyClient/Invalidation/PurgeCapable.php
  36. +4 −6 src/ProxyClient/Invalidation/RefreshCapable.php
  37. +2 −4 src/ProxyClient/Invalidation/TagCapable.php
  38. +27 −50 src/ProxyClient/MultiplexerClient.php
  39. +5 −8 src/ProxyClient/Nginx.php
  40. +7 −7 src/ProxyClient/Noop.php
  41. +1 −1 src/ProxyClient/ProxyClient.php
  42. +10 −7 src/ProxyClient/Symfony.php
  43. +19 −10 src/ProxyClient/Varnish.php
  44. +15 −28 src/ResponseTagger.php
  45. +5 −21 src/SymfonyCache/AccessControlledListener.php
  46. +16 −46 src/SymfonyCache/CacheEvent.php
  47. +25 −26 src/SymfonyCache/CacheInvalidation.php
  48. +7 −12 src/SymfonyCache/CleanupCacheTagsListener.php
  49. +0 −47 src/SymfonyCache/Compatibility/CacheInvalidationLegacy.php
  50. +0 −47 src/SymfonyCache/Compatibility/CacheInvalidationS6.php
  51. +23 −29 src/SymfonyCache/CustomTtlListener.php
  52. +6 −3 src/SymfonyCache/DebugListener.php
  53. +10 −20 src/SymfonyCache/EventDispatchingHttpCache.php
  54. +3 −9 src/SymfonyCache/HttpCacheAware.php
  55. +1 −4 src/SymfonyCache/HttpCacheProvider.php
  56. +8 −13 src/SymfonyCache/KernelDispatcher.php
  57. +4 −10 src/SymfonyCache/PurgeListener.php
  58. +6 −15 src/SymfonyCache/PurgeTagsListener.php
  59. +2 −7 src/SymfonyCache/RefreshListener.php
  60. +4 −10 src/SymfonyCache/UserContextListener.php
  61. +7 −21 src/TagHeaderFormatter/CommaSeparatedTagHeaderFormatter.php
  62. +11 −28 src/TagHeaderFormatter/MaxHeaderValueLengthFormatter.php
  63. +2 −4 src/TagHeaderFormatter/TagHeaderFormatter.php
  64. +1 −1 src/TagHeaderFormatter/TagHeaderParser.php
  65. +4 −4 src/Test/CacheAssertions.php
  66. +70 −80 src/Test/EventDispatchingHttpCacheTestCase.php
  67. +7 −16 src/Test/HttpCaller.php
  68. +31 −54 src/Test/HttpClient.php
  69. +0 −22 src/Test/Legacy/PHPUnit/AbstractCacheConstraint.php
  70. +0 −145 src/Test/Legacy/WebServerListener.php
  71. +0 −153 src/Test/Legacy/WebServerListener6.php
  72. +11 −29 src/Test/NginxTest.php
  73. +49 −12 src/Test/PHPUnit/AbstractCacheConstraint.php
  74. +0 −84 src/Test/PHPUnit/AbstractCacheConstraintTrait.php
  75. +1 −1 src/Test/PHPUnit/IsCacheHitConstraint.php
  76. +1 −1 src/Test/PHPUnit/IsCacheMissConstraint.php
  77. +21 −55 src/Test/Proxy/AbstractProxy.php
  78. +11 −22 src/Test/Proxy/NginxProxy.php
  79. +3 −3 src/Test/Proxy/ProxyInterface.php
  80. +5 −19 src/Test/Proxy/SymfonyProxy.php
  81. +22 −62 src/Test/Proxy/VarnishProxy.php
  82. +8 −24 src/Test/SymfonyTest.php
  83. +14 −37 src/Test/VarnishTest.php
  84. +0 −162 src/Test/WebServerListener.php
  85. +61 −62 src/Test/{WebServerListenerTrait.php → WebServerSubscriber.php}
  86. +25 −0 src/Test/WebServerSubscriberExtension.php
  87. +2 −5 src/UserContext/AnonymousRequestMatcher.php
  88. +2 −2 src/UserContext/ContextProvider.php
  89. +3 −5 src/UserContext/DefaultHashGenerator.php
  90. +2 −5 src/UserContext/HashGenerator.php
  91. +10 −12 src/UserContext/UserContext.php
  92. +3 −4 tests/Functional/CacheInvalidatorTest.php
  93. +3 −3 tests/Functional/Fixtures/Symfony/AppKernel.php
  94. +4 −4 tests/Functional/ProxyClient/BanAssertions.php
  95. +5 −5 tests/Functional/ProxyClient/HttpDispatcherTest.php
  96. +3 −4 tests/Functional/ProxyClient/InvalidateTagsAssertions.php
  97. +12 −13 tests/Functional/ProxyClient/NginxProxyClientTest.php
  98. +3 −3 tests/Functional/ProxyClient/PurgeAssertions.php
  99. +2 −2 tests/Functional/ProxyClient/RefreshAssertions.php
  100. +10 −11 tests/Functional/ProxyClient/SymfonyProxyClientTest.php
  101. +12 −13 tests/Functional/ProxyClient/VarnishProxyClientTest.php
  102. +5 −4 tests/Functional/Symfony/EventDispatchingHttpCacheTest.php
  103. +9 −12 tests/Functional/Varnish/CustomTtlTest.php
  104. +11 −13 tests/Functional/Varnish/UserContextCacheTest.php
  105. +13 −20 tests/Functional/Varnish/UserContextFailureTest.php
  106. +11 −13 tests/Functional/Varnish/UserContextNocacheTest.php
  107. +8 −11 tests/Functional/Varnish/UserContextTestCase.php
  108. +22 −15 tests/Unit/CacheInvalidatorTest.php
  109. +2 −2 tests/Unit/Exception/ExceptionCollectionTest.php
  110. +5 −8 tests/Unit/ProxyClient/CloudflareTest.php
  111. +8 −11 tests/Unit/ProxyClient/FastlyTest.php
  112. +48 −71 tests/Unit/ProxyClient/HttpDispatcherTest.php
  113. +2 −2 tests/Unit/ProxyClient/HttpProxyClientTest.php
  114. +12 −12 tests/Unit/ProxyClient/MultiplexerClientTest.php
  115. +8 −11 tests/Unit/ProxyClient/NoopTest.php
  116. +27 −39 tests/Unit/ProxyClient/SymfonyTest.php
  117. +11 −14 tests/Unit/ProxyClient/VarnishTest.php
  118. +17 −9 tests/Unit/ResponseTaggerTest.php
  119. +39 −0 tests/Unit/SymfonyCache/CacheAwareTest.php
  120. +3 −6 tests/Unit/SymfonyCache/CacheEventTest.php
  121. +4 −4 tests/Unit/SymfonyCache/CleanupCacheTagsListenerTest.php
  122. +5 −8 tests/Unit/SymfonyCache/CustomTtlListenerTest.php
  123. +6 −9 tests/Unit/SymfonyCache/DebugListenerTest.php
  124. +1 −1 tests/Unit/SymfonyCache/EventDispatchingHttpCacheTest.php
  125. +8 −12 tests/Unit/SymfonyCache/KernelDispatcherTest.php
  126. +17 −28 tests/Unit/SymfonyCache/PurgeListenerTest.php
  127. +19 −20 tests/Unit/SymfonyCache/PurgeTagsListenerTest.php
  128. +8 −15 tests/Unit/SymfonyCache/RefreshListenerTest.php
  129. +27 −39 tests/Unit/SymfonyCache/UserContextListenerTest.php
  130. +6 −6 tests/Unit/TagHeaderFormatter/CommaSeparatedTagHeaderFormatterTest.php
  131. +8 −14 tests/Unit/TagHeaderFormatter/MaxHeaderValueLengthFormatterTest.php
  132. +3 −5 tests/Unit/Test/NginxTestTest.php
  133. +5 −5 tests/Unit/Test/PHPUnit/{AbstractCacheConstraintTest.php → AbstractCacheConstraintTestCase.php}
  134. +8 −12 tests/Unit/Test/PHPUnit/{IsCacheHitConstraintTest.php → IsCacheHitConstraintTestCase.php}
  135. +5 −11 tests/Unit/Test/PHPUnit/{IsCacheMissConstraintTest.php → IsCacheMissConstraintTestCase.php}
  136. +17 −9 tests/Unit/Test/Proxy/AbstractProxyTest.php
  137. +2 −2 tests/Unit/Test/Proxy/SymfonyProxyTest.php
  138. +12 −13 tests/Unit/Test/Proxy/VarnishProxyTest.php
  139. +5 −7 tests/Unit/Test/VarnishTestTest.php
  140. +5 −5 tests/Unit/UserContext/AnonymousRequestMatcherTest.php
  141. +3 −3 tests/Unit/UserContext/HashGeneratorTest.php
  142. +3 −3 tests/Unit/UserContext/UserContextTest.php
145 changes: 83 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -22,17 +22,23 @@ jobs:
matrix:
varnish-version: ['6.6']
varnish-modules-version: ['0.18.0']
php: ['7.3', '7.4', '8.0', '8.1']
php: ['8.1', '8.2', '8.3']
include:
- php: '7.4'
symfony-version: '4.3.*'
- php: '7.4'
symfony-version: '5.0.*'
- php: '8.1'
symfony-version: '6.*'
- php: '8.1'
varnish-version: '7.1'
varnish-modules-version: '0.20.0'
- php: '8.2'
symfony-version: '7.*'
- php: '8.2'
varnish-version: '7.1'
varnish-modules-version: '0.20.0'
- php: '8.3'
symfony-version: '7.*'
- php: '8.3'
varnish-version: '7.1'
varnish-modules-version: '0.20.0'

steps:
- name: Setup PHP
@@ -43,55 +49,35 @@ jobs:
coverage: none

- name: Checkout code
uses: actions/checkout@v2

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Install composer dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
run: |
composer require --no-update ${DEPENDENCIES}
composer update --prefer-dist --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v
uses: actions/checkout@v4

legacyPHP:
name: PHP 7.2 Varnish 6
runs-on: ubuntu-20.04
env:
VARNISH_VERSION: '6.6'
VARNISH_MODULES_VERSION: '0.18.0'

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
- name: Cache module compilation
uses: actions/cache@v4
with:
php-version: 7.2
tools: composer:v2
coverage: none

- name: Checkout code
uses: actions/checkout@v2
path: /tmp/varnish-modules-${{ matrix.varnish-modules-version }}
key: varnish-modules-${{ matrix.varnish-modules-version }}

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-vendor-php-${{ matrix.php }}

- name: Install composer dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
run: |
composer require --no-update ${DEPENDENCIES}
composer update --prefer-dist --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v
run: vendor/bin/phpunit

varnish5:
name: PHP ${{ matrix.php }} Legacy Varnish 5
@@ -104,7 +90,7 @@ jobs:
fail-fast: false
matrix:
include:
- php: '7.4'
- php: '8.1'

steps:
- name: Setup PHP
@@ -115,20 +101,34 @@ jobs:
coverage: none

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache module compilation
uses: actions/cache@v4
with:
path: /tmp/varnish-modules-${{ matrix.varnish-modules-version }}
key: varnish-modules-${{ matrix.varnish-modules-version }}

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish-legacy.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-vendor-legacy

- name: Install composer dependencies
# Lowest discovery can end up with an incompatible psr7 implementation, see discussion in https://github.com/FriendsOfSymfony/FOSHttpCache/pull/567
run: |
composer require --no-update --no-interaction "guzzlehttp/psr7:2.*"
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v
run: vendor/bin/phpunit

varnish4:
name: PHP ${{ matrix.php }} Legacy Varnish 4
@@ -141,7 +141,7 @@ jobs:
fail-fast: false
matrix:
include:
- php: '7.4'
- php: '8.1'

steps:
- name: Setup PHP
@@ -152,20 +152,27 @@ jobs:
coverage: none

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish-legacy.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-vendor-legacy

- name: Install composer dependencies
run: |
composer require --no-update --no-interaction "guzzlehttp/psr7:2.*"
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v
run: vendor/bin/phpunit

lowest:
name: PHP ${{ matrix.php }} Lowest, Varnish 3
@@ -178,7 +185,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.2']
php: ['8.1']

steps:
- name: Setup PHP
@@ -189,20 +196,27 @@ jobs:
coverage: none

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish-legacy.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-vendor-lowest

- name: Install composer dependencies
run: |
composer require --no-update --no-interaction "guzzlehttp/psr7:2.*"
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v
run: vendor/bin/phpunit

coverage:
name: Code Coverage
@@ -215,28 +229,35 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.2
tools: composer:v2
coverage: xdebug

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache module compilation
uses: actions/cache@v4
with:
path: /tmp/varnish-modules-${{ matrix.varnish-modules-version }}
key: varnish-modules-${{ matrix.varnish-modules-version }}

- name: Setup Varnish and Nginx
run: |
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-varnish.sh
sh ${GITHUB_WORKSPACE}/.github/workflows/setup-nginx.sh
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-vendor-php-8.2

- name: Install dependencies
run: |
composer require "friends-of-phpspec/phpspec-code-coverage:^4.3.2" --no-interaction --no-update
composer require "friends-of-phpspec/phpspec-code-coverage:^6.3.0" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress
vendor/bin/simple-phpunit install
- name: Execute tests
run: vendor/bin/simple-phpunit -v --coverage-text --coverage-clover build/coverage.xml

- name: Upload coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}
run: vendor/bin/phpunit --coverage-text --coverage-clover build/coverage.xml
5 changes: 0 additions & 5 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools
@@ -25,7 +23,4 @@ jobs:
run: |
make -C doc/ spelling
if [[ -s "doc/_build/spelling/output.txt" ]]; then echo "\nSpelling errors found\n" && cat "doc/_build/spelling/output.txt"; fi
- name: Spellcheck
run: |
if [[ -s "doc/_build/spelling/output.txt" ]]; then cat "doc/_build/spelling/output.txt"; fi
if [[ -s "doc/_build/spelling/output.txt" ]]; then false; fi
29 changes: 8 additions & 21 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -8,40 +8,27 @@ on:

jobs:
phpstan-src:
name: PHPStan src
name: PHPStan
runs-on: ubuntu-latest
env:
REQUIRE_DEV: "true"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Pull in optional dependencies
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^3.0
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^4.2 symfony/process mockery/mockery phpstan/phpstan-mockery guzzlehttp/guzzle php-http/mock-client

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
- name: Cache Vendor
id: cache-vendor
uses: actions/cache@v4
with:
args: analyze --no-progress

phpstan-tests:
name: PHPStan tests
runs-on: ubuntu-latest
env:
REQUIRE_DEV: "true"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Pull in optional dependencies
run: composer require --no-update phpunit/phpunit toflar/psr6-symfony-http-cache-store:^3.0
path: vendor
key: ${{ runner.os }}-vendor

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
with:
args: analyze --no-progress -c phpstan.tests.neon.dist
args: analyze --no-progress

php-cs-fixer:
name: PHP-CS-Fixer
22 changes: 0 additions & 22 deletions .phpstan/classAliases.php

This file was deleted.

Loading