Skip to content

Commit cd31e96

Browse files
committed
do not use PHPUnit mock objects without configured expectations
1 parent 4143ff1 commit cd31e96

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Tests/Transport/AmqpReceiverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function testTransportMessageIdStampIsCreatedWhenMessageIdIsSet()
8686
$id = '01946fcb-4bcb-7aa7-9727-dac1c0374443';
8787
$amqpEnvelope = $this->createAMQPEnvelope($id);
8888

89-
$connection = $this->createMock(Connection::class);
89+
$connection = $this->createStub(Connection::class);
9090
$connection->method('getQueueNames')->willReturn(['queueName']);
9191
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
9292

@@ -119,7 +119,7 @@ public function testTransportMessageIdStampIsNotCreatedWhenMessageIdIsNotSet()
119119

120120
$amqpEnvelope = $this->createAMQPEnvelope();
121121

122-
$connection = $this->createMock(Connection::class);
122+
$connection = $this->createStub(Connection::class);
123123
$connection->method('getQueueNames')->willReturn(['queueName']);
124124
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
125125

Tests/Transport/AmqpSenderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function testTransportMessageIdStampIsCreatedIfMessageIdIsSet()
128128
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp);
129129
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
130130

131-
$serializer = $this->createMock(SerializerInterface::class);
131+
$serializer = $this->createStub(SerializerInterface::class);
132132
$serializer->method('encode')->with($envelope)->willReturn($encoded);
133133

134134
$connection = $this->createMock(Connection::class);
@@ -149,7 +149,7 @@ public function testTransportMessageIdStampIsNotCreatedIfMessageIdIsNotSet()
149149
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp);
150150
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
151151

152-
$serializer = $this->createMock(SerializerInterface::class);
152+
$serializer = $this->createStub(SerializerInterface::class);
153153
$serializer->method('encode')->with($envelope)->willReturn($encoded);
154154

155155
$connection = $this->createMock(Connection::class);

0 commit comments

Comments
 (0)