Skip to content

Commit c3b54ae

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: fix compatibility with Twig 3.10 [Strings][EnglishInflector] Fix incorrect pluralisation of 'Album' handle union and intersection types for cascaded validations move wiring of the property info extractor to the ObjectNormalizer restore deprecated properties move Process component dep to require-dev Remove calls to `onConsecutiveCalls()` fix: remove unwanted type cast accept AbstractAsset instances when filtering schemas better distinguish URL schemes and windows drive letters handle edge cases when constructing constraints with named arguments convert empty CSV header names into numeric keys
2 parents 7cffc8c + 1e457d6 commit c3b54ae

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

Tests/Transport/FailoverTransportTest.php

+29-14
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,17 @@ public function testSendAllDeadWithinRetryPeriod()
121121
$t1->expects($this->once())->method('send');
122122
$t2 = $this->createMock(TransportInterface::class);
123123
$t2->method('supports')->with($message)->willReturn(true);
124-
$t2->expects($this->exactly(3))
124+
125+
$matcher = $this->exactly(3);
126+
$t2->expects($matcher)
125127
->method('send')
126-
->willReturnOnConsecutiveCalls(
127-
new SentMessage($message, 't2'),
128-
new SentMessage($message, 't2'),
129-
$this->throwException($this->createMock(TransportExceptionInterface::class))
130-
);
128+
->willReturnCallback(function () use ($matcher, $message) {
129+
if (3 === $matcher->getInvocationCount()) {
130+
throw $this->createMock(TransportExceptionInterface::class);
131+
}
132+
133+
return new SentMessage($message, 't2');
134+
});
131135
$t = new FailoverTransport([$t1, $t2], 40);
132136
$t->send($message);
133137
sleep(4);
@@ -146,16 +150,27 @@ public function testSendOneDeadButRecover()
146150

147151
$t1 = $this->createMock(TransportInterface::class);
148152
$t1->method('supports')->with($message)->willReturn(true);
149-
$t1->expects($this->exactly(2))->method('send')->willReturnOnConsecutiveCalls(
150-
$this->throwException($this->createMock(TransportExceptionInterface::class)),
151-
new SentMessage($message, 't1')
152-
);
153+
154+
$t1Matcher = $this->exactly(2);
155+
$t1->expects($t1Matcher)->method('send')
156+
->willReturnCallback(function () use ($t1Matcher, $message) {
157+
if (1 === $t1Matcher->getInvocationCount()) {
158+
throw $this->createMock(TransportExceptionInterface::class);
159+
}
160+
161+
return new SentMessage($message, 't1');
162+
});
153163
$t2 = $this->createMock(TransportInterface::class);
154164
$t2->method('supports')->with($message)->willReturn(true);
155-
$t2->expects($this->exactly(2))->method('send')->willReturnOnConsecutiveCalls(
156-
new SentMessage($message, 't2'),
157-
$this->throwException($this->createMock(TransportExceptionInterface::class))
158-
);
165+
166+
$t2Matcher = $this->exactly(2);
167+
$t2->expects($t2Matcher)->method('send')->willReturnCallback(function () use ($t2Matcher, $message) {
168+
if (1 === $t2Matcher->getInvocationCount()) {
169+
return new SentMessage($message, 't1');
170+
}
171+
172+
throw $this->createMock(TransportExceptionInterface::class);
173+
});
159174

160175
$t = new FailoverTransport([$t1, $t2], 1);
161176

0 commit comments

Comments
 (0)