Skip to content

Commit e317e99

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 36efa3a + 19bb275 commit e317e99

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Tests/Extension/StopwatchExtensionTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,22 @@ protected function getStopwatch($events = [])
5757
$events = \is_array($events) ? $events : [$events];
5858
$stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock();
5959

60-
$i = -1;
60+
$expectedCalls = 0;
61+
$expectedStartCalls = [];
62+
$expectedStopCalls = [];
6163
foreach ($events as $eventName) {
62-
$stopwatch->expects($this->at(++$i))
63-
->method('start')
64-
->with($this->equalTo($eventName), 'template')
65-
;
66-
$stopwatch->expects($this->at(++$i))
67-
->method('stop')
68-
->with($this->equalTo($eventName))
69-
;
64+
++$expectedCalls;
65+
$expectedStartCalls[] = [$this->equalTo($eventName), 'template'];
66+
$expectedStopCalls[] = [$this->equalTo($eventName)];
7067
}
7168

69+
$startInvocationMocker = $stopwatch->expects($this->exactly($expectedCalls))
70+
->method('start');
71+
\call_user_func_array([$startInvocationMocker, 'withConsecutive'], $expectedStartCalls);
72+
$stopInvocationMocker = $stopwatch->expects($this->exactly($expectedCalls))
73+
->method('stop');
74+
\call_user_func_array([$stopInvocationMocker, 'withConsecutive'], $expectedStopCalls);
75+
7276
return $stopwatch;
7377
}
7478
}

0 commit comments

Comments
 (0)