File tree Expand file tree Collapse file tree 9 files changed +30
-11
lines changed Expand file tree Collapse file tree 9 files changed +30
-11
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,17 @@ Changelog
14
14
` "strong" ` or ` "weak" ` respectively.
15
15
Value ` true ` due to backward compatibility will be resolved as ` "strong" ` .
16
16
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
+
17
28
2.1.0
18
29
-----
19
30
Original file line number Diff line number Diff line change 13
13
14
14
use Sensio \Bundle \FrameworkExtraBundle \Configuration \ConfigurationAnnotation ;
15
15
use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
16
+ use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
16
17
17
18
/**
18
19
* @Annotation
@@ -67,13 +68,13 @@ public function setParams($params)
67
68
if (is_array ($ value )) {
68
69
if (1 !== count ($ value ) || !isset ($ value ['expression ' ])) {
69
70
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 ' ,
71
72
$ name ,
72
73
print_r ($ value , true )
73
74
));
74
75
}
75
76
// @codeCoverageIgnoreStart
76
- if (!class_exists (' Symfony\Component\ ExpressionLanguage\ExpressionLanguage ' )) {
77
+ if (!class_exists (ExpressionLanguage::class )) {
77
78
throw new InvalidConfigurationException (sprintf (
78
79
'@InvalidateRoute param %s uses an expression but the ExpressionLanguage is not available. ' ,
79
80
$ name
Original file line number Diff line number Diff line change 14
14
use FOS \HttpCacheBundle \Exception \InvalidTagException ;
15
15
use Sensio \Bundle \FrameworkExtraBundle \Configuration \ConfigurationAnnotation ;
16
16
use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
17
+ use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
17
18
18
19
/**
19
20
* @Annotation
@@ -39,8 +40,8 @@ public function setValue($data)
39
40
public function setExpression ($ expression )
40
41
{
41
42
// @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. ' );
44
45
}
45
46
// @codeCoverageIgnoreEnd
46
47
$ this ->expression = $ expression ;
Original file line number Diff line number Diff line change 19
19
use Symfony \Component \Config \Definition \Builder \TreeBuilder ;
20
20
use Symfony \Component \Config \Definition \ConfigurationInterface ;
21
21
use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
22
+ use Symfony \Component \ExpressionLanguage \ExpressionLanguage ;
22
23
use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
23
24
24
25
/**
@@ -529,7 +530,7 @@ private function addTagSection(ArrayNodeDefinition $rootNode)
529
530
->fixXmlConfig ('tag_expression ' )
530
531
->validate ()
531
532
->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 );
533
534
})
534
535
->thenInvalid ('Configured a tag_expression but ExpressionLanugage is not available ' )
535
536
->end ()
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class ContextInvalidationLogoutHandler implements LogoutHandlerInterface
22
22
/**
23
23
* Service used to ban hash request.
24
24
*
25
- * @var \FOS\HttpCache\ProxyClient\Invalidation\ BanCapable
25
+ * @var BanCapable
26
26
*/
27
27
private $ banner ;
28
28
Original file line number Diff line number Diff line change 12
12
namespace FOS \HttpCacheBundle \Tests \Functional \EventListener ;
13
13
14
14
use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
15
+ use Symfony \Component \HttpFoundation \Cookie ;
15
16
16
17
class FlashMessageListenerTest extends WebTestCase
17
18
{
@@ -27,7 +28,7 @@ public function testFlashMessageCookieIsSet()
27
28
$ cookies = $ response ->headers ->getCookies ();
28
29
$ this ->assertCount (2 , $ cookies );
29
30
30
- /** @var \Symfony\Component\HttpFoundation\ Cookie $cookie */
31
+ /** @var Cookie $cookie */
31
32
$ cookie = $ cookies [0 ];
32
33
33
34
$ this ->assertEquals ('/ ' , $ cookie ->getPath ());
Original file line number Diff line number Diff line change 9
9
* file that was distributed with this source code.
10
10
*/
11
11
12
+ use Symfony \Component \Asset \Package ;
12
13
use Symfony \Component \Config \Loader \LoaderInterface ;
13
14
use Symfony \Component \DependencyInjection \ContainerBuilder ;
14
15
use Symfony \Component \HttpFoundation \Session \Storage \MockFileSessionStorage ;
@@ -38,7 +39,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
38
39
{
39
40
$ loader ->load (__DIR__ .'/config/config.yml ' );
40
41
41
- if (class_exists (' Symfony\Component\Asset\ Package' )) {
42
+ if (class_exists (Package::class )) {
42
43
$ loader ->load (function (ContainerBuilder $ container ) {
43
44
$ container ->loadFromExtension ('framework ' , ['assets ' => []]);
44
45
});
Original file line number Diff line number Diff line change 16
16
use Symfony \Component \HttpFoundation \Request ;
17
17
use Symfony \Component \HttpFoundation \Response ;
18
18
use Symfony \Component \HttpKernel \Event \FilterResponseEvent ;
19
+ use Symfony \Component \HttpKernel \HttpKernelInterface ;
19
20
20
21
class CacheControlListenerTest extends \PHPUnit_Framework_TestCase
21
22
{
@@ -389,6 +390,7 @@ public function testMatchRule()
389
390
*/
390
391
public function testUnsafeMethod ()
391
392
{
393
+ /** @var CacheControlListener|\PHPUnit_Framework_MockObject_MockObject $listener */
392
394
$ listener = $ this ->getMockBuilder (CacheControlListener::class)
393
395
->setMethods (['matchRule ' ])
394
396
->getMock ()
@@ -411,8 +413,8 @@ public function testUnsafeMethod()
411
413
*/
412
414
protected function buildEvent ($ method = 'GET ' )
413
415
{
414
- $ kernel = $ this -> getMockBuilder ( ' Symfony\Component\HttpKernel\ HttpKernelInterface' )
415
- -> getMock ( );
416
+ /** @var HttpKernelInterface|\PHPUnit_Framework_MockObject_MockObject $kernel */
417
+ $ kernel = $ this -> createMock (HttpKernelInterface::class );
416
418
$ response = new Response ();
417
419
$ request = new Request ();
418
420
$ request ->setMethod ($ method );
Original file line number Diff line number Diff line change 14
14
use FOS \HttpCache \UserContext \UserContext ;
15
15
use FOS \HttpCacheBundle \UserContext \RoleProvider ;
16
16
use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
17
+ use Symfony \Component \Security \Core \Authentication \Token \TokenInterface ;
17
18
use Symfony \Component \Security \Core \Role \Role ;
18
19
19
20
class RoleProviderTest extends \PHPUnit_Framework_TestCase
@@ -22,7 +23,7 @@ public function testProvider()
22
23
{
23
24
$ roles = [new Role ('ROLE_USER ' )];
24
25
25
- $ token = \Mockery::mock (' Symfony\Component\Security\Core\Authentication\Token\ TokenInterface' );
26
+ $ token = \Mockery::mock (TokenInterface::class );
26
27
27
28
$ securityContext = $ this ->getTokenStorageMock ();
28
29
$ securityContext ->shouldReceive ('getToken ' )->andReturn ($ token );
You can’t perform that action at this time.
0 commit comments