Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 55822f7

Browse files
committed
[Mailer] Fix incorrect test
1 parent ea41414 commit 55822f7

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/Symfony/Component/Mailer/Tests/Transport/RoundRobinTransportTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,20 @@ public function testSendAllDead()
6060
$t2 = $this->createMock(TransportInterface::class);
6161
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
6262
$t = new RoundRobinTransport([$t1, $t2]);
63-
$this->expectException(TransportException::class);
64-
$this->expectExceptionMessage('All transports failed.');
65-
$t->send(new RawMessage(''));
66-
$this->assertTransports($t, 1, [$t1, $t2]);
63+
$p = new \ReflectionProperty($t, 'cursor');
64+
$p->setValue($t, 0);
65+
66+
try {
67+
$t->send(new RawMessage(''));
68+
} catch (\Exception $e) {
69+
$this->assertInstanceOf(TransportException::class, $e);
70+
$this->assertStringContainsString('All transports failed.', $e->getMessage());
71+
$this->assertTransports($t, 0, [$t1, $t2]);
72+
73+
return;
74+
}
75+
76+
$this->fail('The expected exception was not thrown.');
6777
}
6878

6979
public function testSendOneDead()

0 commit comments

Comments
 (0)