Skip to content

Commit 2a5e44d

Browse files
Mitigate PHPUnit deprecations
1 parent 13f4fac commit 2a5e44d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Tests/Transport/FailoverTransportTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public function testSendFirstWork()
5757
public function testSendAllDead()
5858
{
5959
$t1 = $this->createMock(TransportInterface::class);
60-
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
60+
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
6161
$t2 = $this->createMock(TransportInterface::class);
62-
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
62+
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
6363
$t = new FailoverTransport([$t1, $t2]);
6464
$this->expectException(TransportException::class);
6565
$this->expectExceptionMessage('All transports failed.');
@@ -70,7 +70,7 @@ public function testSendAllDead()
7070
public function testSendOneDead()
7171
{
7272
$t1 = $this->createMock(TransportInterface::class);
73-
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
73+
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
7474
$t2 = $this->createMock(TransportInterface::class);
7575
$t2->expects($this->exactly(3))->method('send');
7676
$t = new FailoverTransport([$t1, $t2]);

Tests/Transport/RoundRobinTransportTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public function testSendAlternate()
5757
public function testSendAllDead()
5858
{
5959
$t1 = $this->createMock(TransportInterface::class);
60-
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
60+
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
6161
$t2 = $this->createMock(TransportInterface::class);
62-
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
62+
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
6363
$t = new RoundRobinTransport([$t1, $t2]);
6464
$p = new \ReflectionProperty($t, 'cursor');
6565
$p->setAccessible(true);
@@ -81,7 +81,7 @@ public function testSendAllDead()
8181
public function testSendOneDead()
8282
{
8383
$t1 = $this->createMock(TransportInterface::class);
84-
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
84+
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
8585
$t2 = $this->createMock(TransportInterface::class);
8686
$t2->expects($this->exactly(3))->method('send');
8787
$t = new RoundRobinTransport([$t1, $t2]);
@@ -101,7 +101,7 @@ public function testSendOneDeadAndRecoveryNotWithinRetryPeriod()
101101
$t1 = $this->createMock(TransportInterface::class);
102102
$t1->expects($this->exactly(4))->method('send');
103103
$t2 = $this->createMock(TransportInterface::class);
104-
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
104+
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
105105
$t = new RoundRobinTransport([$t1, $t2], 60);
106106
$p = new \ReflectionProperty($t, 'cursor');
107107
$p->setAccessible(true);
@@ -152,13 +152,13 @@ public function testFailureDebugInformation()
152152
$t1 = $this->createMock(TransportInterface::class);
153153
$e1 = new TransportException();
154154
$e1->appendDebug('Debug message 1');
155-
$t1->expects($this->once())->method('send')->will($this->throwException($e1));
155+
$t1->expects($this->once())->method('send')->willThrowException($e1);
156156
$t1->expects($this->once())->method('__toString')->willReturn('t1');
157157

158158
$t2 = $this->createMock(TransportInterface::class);
159159
$e2 = new TransportException();
160160
$e2->appendDebug('Debug message 2');
161-
$t2->expects($this->once())->method('send')->will($this->throwException($e2));
161+
$t2->expects($this->once())->method('send')->willThrowException($e2);
162162
$t2->expects($this->once())->method('__toString')->willReturn('t2');
163163

164164
$t = new RoundRobinTransport([$t1, $t2]);

0 commit comments

Comments
 (0)