Skip to content

Commit 9915568

Browse files
More cleanups and fixes
1 parent 5277cc4 commit 9915568

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Tests/Transport/BeanstalkdReceiverTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testItReturnsTheDecodedMessageToTheHandler()
3232
$tube = 'foo bar';
3333

3434
$beanstalkdEnvelope = $this->createBeanstalkdEnvelope();
35-
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
35+
$connection = $this->createMock(Connection::class);
3636
$connection->expects($this->once())->method('get')->willReturn($beanstalkdEnvelope);
3737
$connection->expects($this->once())->method('getTube')->willReturn($tube);
3838

@@ -53,7 +53,7 @@ public function testItReturnsEmptyArrayIfThereAreNoMessages()
5353
{
5454
$serializer = $this->createSerializer();
5555

56-
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
56+
$connection = $this->createMock(Connection::class);
5757
$connection->expects($this->once())->method('get')->willReturn(null);
5858

5959
$receiver = new BeanstalkdReceiver($connection, $serializer);
@@ -70,7 +70,7 @@ public function testItRejectTheMessageIfThereIsAMessageDecodingFailedException()
7070
$serializer->expects($this->once())->method('decode')->willThrowException(new MessageDecodingFailedException());
7171

7272
$beanstalkdEnvelope = $this->createBeanstalkdEnvelope();
73-
$connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
73+
$connection = $this->createMock(Connection::class);
7474
$connection->expects($this->once())->method('get')->willReturn($beanstalkdEnvelope);
7575
$connection->expects($this->once())->method('reject');
7676

Tests/Transport/BeanstalkdSenderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ public function testSend()
2626
$envelope = new Envelope(new DummyMessage('Oy'));
2727
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
2828

29-
$connection = $this->getMockBuilder(Connection::class)
30-
->disableOriginalConstructor()
31-
->getMock();
29+
$connection = $this->createMock(Connection::class);
3230
$connection->expects($this->once())->method('send')->with($encoded['body'], $encoded['headers'], 0);
3331

34-
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
32+
$serializer = $this->createMock(SerializerInterface::class);
3533
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
3634

3735
$sender = new BeanstalkdSender($connection, $serializer);

0 commit comments

Comments
 (0)