Skip to content

Commit

Permalink
Mitigate PHPUnit deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Sep 8, 2024
1 parent 13f4fac commit 2a5e44d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Tests/Transport/FailoverTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public function testSendFirstWork()
public function testSendAllDead()
{
$t1 = $this->createMock(TransportInterface::class);
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
$t2 = $this->createMock(TransportInterface::class);
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
$t = new FailoverTransport([$t1, $t2]);
$this->expectException(TransportException::class);
$this->expectExceptionMessage('All transports failed.');
Expand All @@ -70,7 +70,7 @@ public function testSendAllDead()
public function testSendOneDead()
{
$t1 = $this->createMock(TransportInterface::class);
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
$t2 = $this->createMock(TransportInterface::class);
$t2->expects($this->exactly(3))->method('send');
$t = new FailoverTransport([$t1, $t2]);
Expand Down
12 changes: 6 additions & 6 deletions Tests/Transport/RoundRobinTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public function testSendAlternate()
public function testSendAllDead()
{
$t1 = $this->createMock(TransportInterface::class);
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
$t2 = $this->createMock(TransportInterface::class);
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
$t = new RoundRobinTransport([$t1, $t2]);
$p = new \ReflectionProperty($t, 'cursor');
$p->setAccessible(true);
Expand All @@ -81,7 +81,7 @@ public function testSendAllDead()
public function testSendOneDead()
{
$t1 = $this->createMock(TransportInterface::class);
$t1->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t1->expects($this->once())->method('send')->willThrowException(new TransportException());
$t2 = $this->createMock(TransportInterface::class);
$t2->expects($this->exactly(3))->method('send');
$t = new RoundRobinTransport([$t1, $t2]);
Expand All @@ -101,7 +101,7 @@ public function testSendOneDeadAndRecoveryNotWithinRetryPeriod()
$t1 = $this->createMock(TransportInterface::class);
$t1->expects($this->exactly(4))->method('send');
$t2 = $this->createMock(TransportInterface::class);
$t2->expects($this->once())->method('send')->will($this->throwException(new TransportException()));
$t2->expects($this->once())->method('send')->willThrowException(new TransportException());
$t = new RoundRobinTransport([$t1, $t2], 60);
$p = new \ReflectionProperty($t, 'cursor');
$p->setAccessible(true);
Expand Down Expand Up @@ -152,13 +152,13 @@ public function testFailureDebugInformation()
$t1 = $this->createMock(TransportInterface::class);
$e1 = new TransportException();
$e1->appendDebug('Debug message 1');
$t1->expects($this->once())->method('send')->will($this->throwException($e1));
$t1->expects($this->once())->method('send')->willThrowException($e1);
$t1->expects($this->once())->method('__toString')->willReturn('t1');

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

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

0 comments on commit 2a5e44d

Please sign in to comment.