@@ -47,13 +47,15 @@ public function testLocaleIsSetInOnKernelRequest()
47
47
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest ()
48
48
{
49
49
$ this ->localeAwareService
50
- ->expects ($ this ->at ( 0 ))
50
+ ->expects ($ this ->exactly ( 2 ))
51
51
->method ('setLocale ' )
52
- ->will ($ this ->throwException (new \InvalidArgumentException ()));
53
- $ this ->localeAwareService
54
- ->expects ($ this ->at (1 ))
55
- ->method ('setLocale ' )
56
- ->with ($ this ->equalTo ('en ' ));
52
+ ->withConsecutive (
53
+ [$ this ->anything ()],
54
+ ['en ' ]
55
+ )
56
+ ->willReturnOnConsecutiveCalls (
57
+ $ this ->throwException (new \InvalidArgumentException ())
58
+ );
57
59
58
60
$ event = new RequestEvent ($ this ->createHttpKernel (), $ this ->createRequest ('fr ' ), HttpKernelInterface::MASTER_REQUEST );
59
61
$ this ->listener ->onKernelRequest ($ event );
@@ -89,13 +91,15 @@ public function testLocaleIsSetToDefaultOnKernelFinishRequestWhenParentRequestDo
89
91
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest ()
90
92
{
91
93
$ this ->localeAwareService
92
- ->expects ($ this ->at ( 0 ))
94
+ ->expects ($ this ->exactly ( 2 ))
93
95
->method ('setLocale ' )
94
- ->will ($ this ->throwException (new \InvalidArgumentException ()));
95
- $ this ->localeAwareService
96
- ->expects ($ this ->at (1 ))
97
- ->method ('setLocale ' )
98
- ->with ($ this ->equalTo ('en ' ));
96
+ ->withConsecutive (
97
+ [$ this ->anything ()],
98
+ ['en ' ]
99
+ )
100
+ ->willReturnOnConsecutiveCalls (
101
+ $ this ->throwException (new \InvalidArgumentException ())
102
+ );
99
103
100
104
$ this ->requestStack ->push ($ this ->createRequest ('fr ' ));
101
105
$ this ->requestStack ->push ($ subRequest = $ this ->createRequest ('de ' ));
0 commit comments