Skip to content

Commit 97eaf18

Browse files
authored
Merge pull request #402 from FriendsOfSymfony/prepare-2.2-alpha
cleanup before 2.2 alpha release
2 parents 2278528 + 0a79a26 commit 97eaf18

File tree

9 files changed

+30
-11
lines changed

9 files changed

+30
-11
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ Changelog
1414
`"strong"` or `"weak"` respectively.
1515
Value `true` due to backward compatibility will be resolved as `"strong"`.
1616

17+
### Fixed
18+
19+
* The FlashMessageListener has been broken during refactoring for 2.0 and now
20+
works again. Constructor uses an options array.
21+
22+
* Tag annotations now work with SensioFrameworkExtraBundle 4. An accidental
23+
exception prevents using them with FOSHttpCacheBundle 2.0 and 2.1.
24+
25+
* User context is more reliable not cache when the hash mismatches. (E.g. after
26+
login/logout.)
27+
1728
2.1.0
1829
-----
1930

src/Configuration/InvalidateRoute.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation;
1515
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
16+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
1617

1718
/**
1819
* @Annotation
@@ -67,13 +68,13 @@ public function setParams($params)
6768
if (is_array($value)) {
6869
if (1 !== count($value) || !isset($value['expression'])) {
6970
throw new \RuntimeException(sprintf(
70-
'@InvalidateRoute param %s must be string or {"expression"="<expression>"}',
71+
'@InvalidateRoute param %s must be string or {"expression"="<expression>"}, %s given',
7172
$name,
7273
print_r($value, true)
7374
));
7475
}
7576
// @codeCoverageIgnoreStart
76-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
77+
if (!class_exists(ExpressionLanguage::class)) {
7778
throw new InvalidConfigurationException(sprintf(
7879
'@InvalidateRoute param %s uses an expression but the ExpressionLanguage is not available.',
7980
$name

src/Configuration/Tag.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use FOS\HttpCacheBundle\Exception\InvalidTagException;
1515
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation;
1616
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
17+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
1718

1819
/**
1920
* @Annotation
@@ -39,8 +40,8 @@ public function setValue($data)
3940
public function setExpression($expression)
4041
{
4142
// @codeCoverageIgnoreStart
42-
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
43-
throw new InvalidConfigurationException('@Tag param %s uses an expression but the ExpressionLanguage is not available.');
43+
if (!class_exists(ExpressionLanguage::class)) {
44+
throw new InvalidConfigurationException('@Tag param uses an expression but the ExpressionLanguage is not available.');
4445
}
4546
// @codeCoverageIgnoreEnd
4647
$this->expression = $expression;

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
2020
use Symfony\Component\Config\Definition\ConfigurationInterface;
2121
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
22+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
2223
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2324

2425
/**
@@ -529,7 +530,7 @@ private function addTagSection(ArrayNodeDefinition $rootNode)
529530
->fixXmlConfig('tag_expression')
530531
->validate()
531532
->ifTrue(function ($v) {
532-
return !empty($v['tag_expressions']) && !class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage');
533+
return !empty($v['tag_expressions']) && !class_exists(ExpressionLanguage::class);
533534
})
534535
->thenInvalid('Configured a tag_expression but ExpressionLanugage is not available')
535536
->end()

src/Security/Http/Logout/ContextInvalidationLogoutHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ContextInvalidationLogoutHandler implements LogoutHandlerInterface
2222
/**
2323
* Service used to ban hash request.
2424
*
25-
* @var \FOS\HttpCache\ProxyClient\Invalidation\BanCapable
25+
* @var BanCapable
2626
*/
2727
private $banner;
2828

tests/Functional/EventListener/FlashMessageListenerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace FOS\HttpCacheBundle\Tests\Functional\EventListener;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
15+
use Symfony\Component\HttpFoundation\Cookie;
1516

1617
class FlashMessageListenerTest extends WebTestCase
1718
{
@@ -27,7 +28,7 @@ public function testFlashMessageCookieIsSet()
2728
$cookies = $response->headers->getCookies();
2829
$this->assertCount(2, $cookies);
2930

30-
/** @var \Symfony\Component\HttpFoundation\Cookie $cookie */
31+
/** @var Cookie $cookie */
3132
$cookie = $cookies[0];
3233

3334
$this->assertEquals('/', $cookie->getPath());

tests/Functional/Fixtures/app/AppKernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
use Symfony\Component\Asset\Package;
1213
use Symfony\Component\Config\Loader\LoaderInterface;
1314
use Symfony\Component\DependencyInjection\ContainerBuilder;
1415
use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
@@ -38,7 +39,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
3839
{
3940
$loader->load(__DIR__.'/config/config.yml');
4041

41-
if (class_exists('Symfony\Component\Asset\Package')) {
42+
if (class_exists(Package::class)) {
4243
$loader->load(function (ContainerBuilder $container) {
4344
$container->loadFromExtension('framework', ['assets' => []]);
4445
});

tests/Unit/EventListener/CacheControlListenerTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
19+
use Symfony\Component\HttpKernel\HttpKernelInterface;
1920

2021
class CacheControlListenerTest extends \PHPUnit_Framework_TestCase
2122
{
@@ -389,6 +390,7 @@ public function testMatchRule()
389390
*/
390391
public function testUnsafeMethod()
391392
{
393+
/** @var CacheControlListener|\PHPUnit_Framework_MockObject_MockObject $listener */
392394
$listener = $this->getMockBuilder(CacheControlListener::class)
393395
->setMethods(['matchRule'])
394396
->getMock()
@@ -411,8 +413,8 @@ public function testUnsafeMethod()
411413
*/
412414
protected function buildEvent($method = 'GET')
413415
{
414-
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
415-
->getMock();
416+
/** @var HttpKernelInterface|\PHPUnit_Framework_MockObject_MockObject $kernel */
417+
$kernel = $this->createMock(HttpKernelInterface::class);
416418
$response = new Response();
417419
$request = new Request();
418420
$request->setMethod($method);

tests/Unit/UserContext/RoleProviderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use FOS\HttpCache\UserContext\UserContext;
1515
use FOS\HttpCacheBundle\UserContext\RoleProvider;
1616
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
17+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1718
use Symfony\Component\Security\Core\Role\Role;
1819

1920
class RoleProviderTest extends \PHPUnit_Framework_TestCase
@@ -22,7 +23,7 @@ public function testProvider()
2223
{
2324
$roles = [new Role('ROLE_USER')];
2425

25-
$token = \Mockery::mock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
26+
$token = \Mockery::mock(TokenInterface::class);
2627

2728
$securityContext = $this->getTokenStorageMock();
2829
$securityContext->shouldReceive('getToken')->andReturn($token);

0 commit comments

Comments
 (0)