Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Merge tag '1.5.4' into develop
Browse files Browse the repository at this point in the history
no message
  • Loading branch information
Toflar committed May 15, 2019
2 parents e47d68a + 8802126 commit 3305d3b
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -12,7 +12,7 @@
"require": {
"php": "^5.6 | ^7.0",
"friendsofsymfony/http-cache-bundle": "^2.1",
"friendsofsymfony/http-cache": "^2.1",
"friendsofsymfony/http-cache": "^2.7",
"symfony/options-resolver": "^3.3 | ^4.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/HeaderReplayExtension.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion src/Event/HeaderReplayEvent.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/HeaderReplayListener.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/HeaderReplayStopPropagationListener.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion src/HeaderReplayBundle.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
4 changes: 2 additions & 2 deletions src/SymfonyCache/HeaderReplaySubscriber.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down Expand Up @@ -98,7 +98,7 @@ public function preHandle(CacheEvent $event)
// Pass the duplicated request to the original kernel (so cache is bypassed)
// which should result in the preflight request response handled by the
// HeaderReplayListener
$preflightResponse = $httpCache->getKernel()->handle($duplicate);
$preflightResponse = $httpCache->getKernel()->handle($duplicate, $event->getRequestType());

// Early abort if the preflight response wanted to redirect for whatever
// reason
Expand Down
2 changes: 1 addition & 1 deletion tests/DependencyInjection/HeaderReplayExtensionTest.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion tests/Event/HeaderReplayEventTest.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion tests/EventListener/HeaderReplayListenerTest.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion tests/SymfonyCache/DummyHttpCacheKernel.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
2 changes: 1 addition & 1 deletion tests/SymfonyCache/DummyNonHttpCacheKernel.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down
45 changes: 40 additions & 5 deletions tests/SymfonyCache/HeaderReplaySubscriberTest.php
Expand Up @@ -3,7 +3,7 @@
/*
* terminal42/header-replay-bundle for Symfony
*
* @copyright Copyright (c) 2008-2018, terminal42 gmbh
* @copyright Copyright (c) 2008-2019, terminal42 gmbh
* @author terminal42 gmbh <info@terminal42.ch>
* @license MIT
* @link http://github.com/terminal42/header-replay-bundle
Expand Down Expand Up @@ -146,10 +146,13 @@ public function testKernelIsCorrectlyCalledWithPreflightAcceptHeader()
$kernel
->expects($this->once())
->method('handle')
->with($this->callback(function (Request $request) {
return 'HEAD' === $request->getMethod() &&
HeaderReplayListener::CONTENT_TYPE === $request->headers->get('Accept');
}))
->with(
$this->callback(function (Request $request) {
return 'HEAD' === $request->getMethod() &&
HeaderReplayListener::CONTENT_TYPE === $request->headers->get('Accept');
}),
$this->equalTo(HttpKernelInterface::MASTER_REQUEST)
)
->willReturn($response);

$httpCache = $this->getHttpCacheKernelWithGivenKernel($kernel);
Expand All @@ -166,6 +169,38 @@ public function testKernelIsCorrectlyCalledWithPreflightAcceptHeader()
$subscriber->preHandle($cacheEvent);
}

public function testKernelIsCorrectlyCalledWithRequestType()
{
$response = new Response();
$kernel = $this->createMock(HttpCache::class);
$kernel
->expects($this->once())
->method('handle')
->with(
$this->callback(function (Request $request) {
return 'HEAD' === $request->getMethod() &&
HeaderReplayListener::CONTENT_TYPE === $request->headers->get('Accept');
}),
$this->equalTo(HttpKernelInterface::SUB_REQUEST)
)
->willReturn($response);

$httpCache = $this->getHttpCacheKernelWithGivenKernel($kernel);

$request = Request::create('/foobar', 'GET');
$request->cookies->set('Foo', 'Bar');

$cacheEvent = new CacheEvent(
$httpCache,
$request,
null,
HttpKernelInterface::SUB_REQUEST
);

$subscriber = new HeaderReplaySubscriber();
$subscriber->preHandle($cacheEvent);
}

public function testEarlyAbortIfRedirectionOnPreflightResponse()
{
$response = new RedirectResponse('https://foobar.com');
Expand Down

0 comments on commit 3305d3b

Please sign in to comment.