Skip to content

Commit 729712e

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: add validator translation 99 for Italian language stop using the deprecated at() PHPUnit matcher Fix typehint phpdoc
2 parents f7cfbe3 + a031f69 commit 729712e

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

Tests/Controller/ContainerControllerResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Psr\Container\ContainerInterface;
1515
use Psr\Log\LoggerInterface;
1616
use Symfony\Component\DependencyInjection\Container;
17+
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\HttpFoundation\Request;
1819
use Symfony\Component\HttpKernel\Controller\ContainerControllerResolver;
1920

Tests/EventListener/TranslatorListenerTest.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ public function testLocaleIsSetInOnKernelRequest()
4949
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelRequest()
5050
{
5151
$this->translator
52-
->expects($this->at(0))
52+
->expects($this->exactly(2))
5353
->method('setLocale')
54-
->willThrowException(new \InvalidArgumentException());
55-
$this->translator
56-
->expects($this->at(1))
57-
->method('setLocale')
58-
->with($this->equalTo('en'));
54+
->withConsecutive(
55+
['fr'],
56+
['en']
57+
)
58+
->willReturnOnConsecutiveCalls(
59+
$this->throwException(new \InvalidArgumentException())
60+
);
5961

6062
$event = new RequestEvent($this->createHttpKernel(), $this->createRequest('fr'), HttpKernelInterface::MASTER_REQUEST);
6163
$this->listener->onKernelRequest($event);
@@ -86,13 +88,15 @@ public function testLocaleIsNotSetInOnKernelFinishRequestWhenParentRequestDoesNo
8688
public function testDefaultLocaleIsUsedOnExceptionsInOnKernelFinishRequest()
8789
{
8890
$this->translator
89-
->expects($this->at(0))
90-
->method('setLocale')
91-
->willThrowException(new \InvalidArgumentException());
92-
$this->translator
93-
->expects($this->at(1))
91+
->expects($this->exactly(2))
9492
->method('setLocale')
95-
->with($this->equalTo('en'));
93+
->withConsecutive(
94+
['fr'],
95+
['en']
96+
)
97+
->willReturnOnConsecutiveCalls(
98+
$this->throwException(new \InvalidArgumentException())
99+
);
96100

97101
$this->setMasterRequest($this->createRequest('fr'));
98102
$event = new FinishRequestEvent($this->createHttpKernel(), $this->createRequest('de'), HttpKernelInterface::SUB_REQUEST);

Tests/HttpKernelTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ public function testVerifyRequestStackPushPopDuringHandle()
304304
$request = new Request();
305305

306306
$stack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->setMethods(['push', 'pop'])->getMock();
307-
$stack->expects($this->at(0))->method('push')->with($this->equalTo($request));
308-
$stack->expects($this->at(1))->method('pop');
307+
$stack->expects($this->once())->method('push')->with($this->equalTo($request));
308+
$stack->expects($this->once())->method('pop');
309309

310310
$dispatcher = new EventDispatcher();
311311
$kernel = $this->getHttpKernel($dispatcher, null, $stack);

Tests/KernelTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
18+
use Symfony\Component\DependencyInjection\ContainerInterface;
1819
use Symfony\Component\Filesystem\Filesystem;
1920
use Symfony\Component\HttpFoundation\Request;
2021
use Symfony\Component\HttpFoundation\Response;
@@ -179,9 +180,12 @@ public function testShutdownCallsShutdownOnAllBundles()
179180
public function testShutdownGivesNullContainerToAllBundles()
180181
{
181182
$bundle = $this->getMockBuilder('Symfony\Component\HttpKernel\Bundle\Bundle')->getMock();
182-
$bundle->expects($this->at(3))
183+
$bundle->expects($this->exactly(2))
183184
->method('setContainer')
184-
->with(null);
185+
->withConsecutive(
186+
[$this->isInstanceOf(ContainerInterface::class)],
187+
[null]
188+
);
185189

186190
$kernel = $this->getKernel(['getBundles']);
187191
$kernel->expects($this->any())

0 commit comments

Comments
 (0)