Skip to content

Commit 4143ff1

Browse files
committed
Merge branch '6.4' into 7.3
* 6.4: do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations Bump Symfony version to 6.4.32 Update VERSION for 6.4.31 Update CONTRIBUTORS for 6.4.31 Update CHANGELOG for 6.4.31 do not use PHPUnit mock objects without configured expectations
2 parents 70667ad + d42682a commit 4143ff1

File tree

7 files changed

+106
-106
lines changed

7 files changed

+106
-106
lines changed

Tests/Transport/AmqpReceivedStampTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AmqpReceivedStampTest extends TestCase
2121
{
2222
public function testStamp()
2323
{
24-
$amqpEnvelope = $this->createMock(\AMQPEnvelope::class);
24+
$amqpEnvelope = $this->createStub(\AMQPEnvelope::class);
2525

2626
$stamp = new AmqpReceivedStamp($amqpEnvelope, 'queueName');
2727

Tests/Transport/AmqpReceiverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testItReturnsTheDecodedMessageToTheHandler()
3939
);
4040

4141
$amqpEnvelope = $this->createAMQPEnvelope();
42-
$connection = $this->createMock(Connection::class);
42+
$connection = $this->createStub(Connection::class);
4343
$connection->method('getQueueNames')->willReturn(['queueName']);
4444
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
4545

@@ -52,9 +52,9 @@ public function testItReturnsTheDecodedMessageToTheHandler()
5252
public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
5353
{
5454
$this->expectException(TransportException::class);
55-
$serializer = $this->createMock(SerializerInterface::class);
55+
$serializer = $this->createStub(SerializerInterface::class);
5656
$amqpEnvelope = $this->createAMQPEnvelope();
57-
$connection = $this->createMock(Connection::class);
57+
$connection = $this->createStub(Connection::class);
5858
$connection->method('getQueueNames')->willReturn(['queueName']);
5959
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
6060
$connection->method('ack')->with($amqpEnvelope, 'queueName')->willThrowException(new \AMQPException());
@@ -66,9 +66,9 @@ public function testItThrowsATransportExceptionIfItCannotAcknowledgeMessage()
6666
public function testItThrowsATransportExceptionIfItCannotRejectMessage()
6767
{
6868
$this->expectException(TransportException::class);
69-
$serializer = $this->createMock(SerializerInterface::class);
69+
$serializer = $this->createStub(SerializerInterface::class);
7070
$amqpEnvelope = $this->createAMQPEnvelope();
71-
$connection = $this->createMock(Connection::class);
71+
$connection = $this->createStub(Connection::class);
7272
$connection->method('getQueueNames')->willReturn(['queueName']);
7373
$connection->method('get')->with('queueName')->willReturn($amqpEnvelope);
7474
$connection->method('nack')->with($amqpEnvelope, 'queueName', \AMQP_NOPARAM)->willThrowException(new \AMQPException());
@@ -145,7 +145,7 @@ public function testTransportMessageIdStampIsNotCreatedWhenMessageIdIsNotSet()
145145

146146
private function createAMQPEnvelope(?string $messageId = null): \AMQPEnvelope
147147
{
148-
$envelope = $this->createMock(\AMQPEnvelope::class);
148+
$envelope = $this->createStub(\AMQPEnvelope::class);
149149
$envelope->method('getBody')->willReturn('{"message": "Hi"}');
150150
$envelope->method('getHeaders')->willReturn([
151151
'type' => DummyMessage::class,

Tests/Transport/AmqpSenderTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testItSendsTheEncodedMessage()
3131
$envelope = new Envelope(new DummyMessage('Oy'));
3232
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
3333

34-
$serializer = $this->createMock(SerializerInterface::class);
34+
$serializer = $this->createStub(SerializerInterface::class);
3535
$serializer->method('encode')->with($envelope)->willReturn($encoded);
3636

3737
$connection = $this->createMock(Connection::class);
@@ -46,7 +46,7 @@ public function testItSendsTheEncodedMessageUsingARoutingKey()
4646
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp = new AmqpStamp('rk'));
4747
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
4848

49-
$serializer = $this->createMock(SerializerInterface::class);
49+
$serializer = $this->createStub(SerializerInterface::class);
5050
$serializer->method('encode')->with($envelope)->willReturn($encoded);
5151

5252
$connection = $this->createMock(Connection::class);
@@ -61,7 +61,7 @@ public function testItSendsTheEncodedMessageWithoutHeaders()
6161
$envelope = new Envelope(new DummyMessage('Oy'));
6262
$encoded = ['body' => '...'];
6363

64-
$serializer = $this->createMock(SerializerInterface::class);
64+
$serializer = $this->createStub(SerializerInterface::class);
6565
$serializer->method('encode')->with($envelope)->willReturn($encoded);
6666

6767
$connection = $this->createMock(Connection::class);
@@ -76,7 +76,7 @@ public function testContentTypeHeaderIsMovedToAttribute()
7676
$envelope = new Envelope(new DummyMessage('Oy'));
7777
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class, 'Content-Type' => 'application/json']];
7878

79-
$serializer = $this->createMock(SerializerInterface::class);
79+
$serializer = $this->createStub(SerializerInterface::class);
8080
$serializer->method('encode')->with($envelope)->willReturn($encoded);
8181

8282
$connection = $this->createMock(Connection::class);
@@ -93,7 +93,7 @@ public function testContentTypeHeaderDoesNotOverwriteAttribute()
9393
$envelope = (new Envelope(new DummyMessage('Oy')))->with($stamp = new AmqpStamp('rk', \AMQP_NOPARAM, ['content_type' => 'custom']));
9494
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class, 'Content-Type' => 'application/json']];
9595

96-
$serializer = $this->createMock(SerializerInterface::class);
96+
$serializer = $this->createStub(SerializerInterface::class);
9797
$serializer->method('encode')->with($envelope)->willReturn($encoded);
9898

9999
$connection = $this->createMock(Connection::class);
@@ -110,10 +110,10 @@ public function testItThrowsATransportExceptionIfItCannotSendTheMessage()
110110
$envelope = new Envelope(new DummyMessage('Oy'));
111111
$encoded = ['body' => '...', 'headers' => ['type' => DummyMessage::class]];
112112

113-
$serializer = $this->createMock(SerializerInterface::class);
113+
$serializer = $this->createStub(SerializerInterface::class);
114114
$serializer->method('encode')->with($envelope)->willReturn($encoded);
115115

116-
$connection = $this->createMock(Connection::class);
116+
$connection = $this->createStub(Connection::class);
117117
$connection->method('publish')->with($encoded['body'], $encoded['headers'])->willThrowException(new \AMQPException());
118118

119119
$sender = new AmqpSender($connection, $serializer);

Tests/Transport/AmqpStampTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testFlagsAndAttributes()
3737

3838
public function testCreateFromAmqpEnvelope()
3939
{
40-
$amqpEnvelope = $this->createMock(\AMQPEnvelope::class);
40+
$amqpEnvelope = $this->createStub(\AMQPEnvelope::class);
4141
$amqpEnvelope->method('getRoutingKey')->willReturn('routingkey');
4242
$amqpEnvelope->method('getDeliveryMode')->willReturn(2);
4343
$amqpEnvelope->method('getPriority')->willReturn(5);
@@ -56,7 +56,7 @@ public function testCreateFromAmqpEnvelope()
5656

5757
public function testCreateFromAmqpEnvelopeWithPreviousStamp()
5858
{
59-
$amqpEnvelope = $this->createMock(\AMQPEnvelope::class);
59+
$amqpEnvelope = $this->createStub(\AMQPEnvelope::class);
6060
$amqpEnvelope->method('getRoutingKey')->willReturn('routingkey');
6161
$amqpEnvelope->method('getDeliveryMode')->willReturn(2);
6262
$amqpEnvelope->method('getPriority')->willReturn(5);

Tests/Transport/AmqpTransportFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testSupportsOnlyAmqpTransports()
3434
public function testItCreatesTheTransport()
3535
{
3636
$factory = new AmqpTransportFactory();
37-
$serializer = $this->createMock(SerializerInterface::class);
37+
$serializer = $this->createStub(SerializerInterface::class);
3838

3939
$expectedTransport = new AmqpTransport(Connection::fromDsn('amqp://localhost', ['host' => 'localhost']), $serializer);
4040

Tests/Transport/AmqpTransportTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public function testItIsATransport()
3434
public function testReceivesMessages()
3535
{
3636
$transport = $this->getTransport(
37-
$serializer = $this->createMock(SerializerInterface::class),
38-
$connection = $this->createMock(Connection::class)
37+
$serializer = $this->createStub(SerializerInterface::class),
38+
$connection = $this->createStub(Connection::class)
3939
);
4040

4141
$decodedMessage = new DummyMessage('Decoded.');
4242

43-
$amqpEnvelope = $this->createMock(\AMQPEnvelope::class);
43+
$amqpEnvelope = $this->createStub(\AMQPEnvelope::class);
4444
$amqpEnvelope->method('getBody')->willReturn('body');
4545
$amqpEnvelope->method('getHeaders')->willReturn(['my' => 'header']);
4646

@@ -54,8 +54,8 @@ public function testReceivesMessages()
5454

5555
private function getTransport(?SerializerInterface $serializer = null, ?Connection $connection = null): AmqpTransport
5656
{
57-
$serializer ??= $this->createMock(SerializerInterface::class);
58-
$connection ??= $this->createMock(Connection::class);
57+
$serializer ??= $this->createStub(SerializerInterface::class);
58+
$connection ??= $this->createStub(Connection::class);
5959

6060
return new AmqpTransport($connection, $serializer);
6161
}

0 commit comments

Comments
 (0)