Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ed5864

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Console] Fix ProgressBar %remaining% and %estimated% placeholder guards [Validator] Fix missing null type in ValidatorInterface::validate() phpdoc use PHPUnit 13 on PHP 8.4+ [PropertyInfo] Prioritize property type over is/has/can accessors
2 parents 81d0b28 + 55bad15 commit 6ed5864

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

Tests/Transport/ConnectionTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function testGetWithNoPendingMessageWillReturnNull()
106106

107107
public function testGetWithSkipLockedWithForUpdateMethod()
108108
{
109-
$queryBuilder = $this->getQueryBuilderStub();
109+
$queryBuilder = $this->getQueryBuilderMock();
110110
$driverConnection = $this->getDBALConnection(true);
111111
$stmt = $this->getResultMock(false);
112112

@@ -117,6 +117,7 @@ public function testGetWithSkipLockedWithForUpdateMethod()
117117
->method('getParameterTypes')
118118
->willReturn([]);
119119
$queryBuilder
120+
->expects($this->once())
120121
->method('forUpdate')
121122
->with(ConflictResolutionMode::SKIP_LOCKED)
122123
->willReturn($queryBuilder);
@@ -528,7 +529,7 @@ public function testItThrowsAnExceptionIfAnExtraOptionsInDefinedInDSN()
528529

529530
public function testFind()
530531
{
531-
$queryBuilder = $this->getQueryBuilderStub();
532+
$queryBuilder = $this->getQueryBuilderMock();
532533
$driverConnection = $this->getDBALConnection();
533534
$id = 1;
534535
$stmt = $this->getResultMock([
@@ -541,6 +542,7 @@ public function testFind()
541542
->method('createQueryBuilder')
542543
->willReturn($queryBuilder);
543544
$queryBuilder
545+
->expects($this->once())
544546
->method('where')
545547
->with('m.id = ? and m.queue_name = ?')
546548
->willReturn($queryBuilder);

Tests/Transport/DoctrineReceiverTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ public function testAll()
116116

117117
$doctrineEnvelope1 = $this->createDoctrineEnvelope();
118118
$doctrineEnvelope2 = $this->createDoctrineEnvelope();
119-
$connection = $this->createStub(Connection::class);
120-
$connection->method('findAll')->with(50)->willReturn([$doctrineEnvelope1, $doctrineEnvelope2]);
119+
$connection = $this->createMock(Connection::class);
120+
$connection->expects($this->once())->method('findAll')->with(50)->willReturn([$doctrineEnvelope1, $doctrineEnvelope2]);
121121

122122
$receiver = new DoctrineReceiver($connection, $serializer);
123123
$actualEnvelopes = iterator_to_array($receiver->all(50));
@@ -131,8 +131,8 @@ public function testAllReplacesExistingTransportMessageIdStamps()
131131

132132
$doctrineEnvelope1 = $this->createRetriedDoctrineEnvelope();
133133
$doctrineEnvelope2 = $this->createRetriedDoctrineEnvelope();
134-
$connection = $this->createStub(Connection::class);
135-
$connection->method('findAll')->willReturn([$doctrineEnvelope1, $doctrineEnvelope2]);
134+
$connection = $this->createMock(Connection::class);
135+
$connection->expects($this->once())->method('findAll')->willReturn([$doctrineEnvelope1, $doctrineEnvelope2]);
136136

137137
$receiver = new DoctrineReceiver($connection, $serializer);
138138
$actualEnvelopes = $receiver->all();
@@ -148,8 +148,8 @@ public function testFind()
148148
$serializer = $this->createSerializer();
149149

150150
$doctrineEnvelope = $this->createDoctrineEnvelope();
151-
$connection = $this->createStub(Connection::class);
152-
$connection->method('find')->with(10)->willReturn($doctrineEnvelope);
151+
$connection = $this->createMock(Connection::class);
152+
$connection->expects($this->once())->method('find')->with(10)->willReturn($doctrineEnvelope);
153153

154154
$receiver = new DoctrineReceiver($connection, $serializer);
155155
$actualEnvelope = $receiver->find(10);
@@ -161,8 +161,8 @@ public function testFindReplacesExistingTransportMessageIdStamps()
161161
$serializer = $this->createSerializer();
162162

163163
$doctrineEnvelope = $this->createRetriedDoctrineEnvelope();
164-
$connection = $this->createStub(Connection::class);
165-
$connection->method('find')->with(3)->willReturn($doctrineEnvelope);
164+
$connection = $this->createMock(Connection::class);
165+
$connection->expects($this->once())->method('find')->with(3)->willReturn($doctrineEnvelope);
166166

167167
$receiver = new DoctrineReceiver($connection, $serializer);
168168
$actualEnvelope = $receiver->find(3);

Tests/Transport/DoctrineSenderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public function testSend()
3030
$connection = $this->createMock(Connection::class);
3131
$connection->expects($this->once())->method('send')->with($encoded['body'], $encoded['headers'])->willReturn('15');
3232

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

3636
$sender = new DoctrineSender($connection, $serializer);
3737
$actualEnvelope = $sender->send($envelope);
@@ -50,8 +50,8 @@ public function testSendWithDelay()
5050
$connection = $this->createMock(Connection::class);
5151
$connection->expects($this->once())->method('send')->with($encoded['body'], $encoded['headers'], 500);
5252

53-
$serializer = $this->createStub(SerializerInterface::class);
54-
$serializer->method('encode')->with($envelope)->willReturn($encoded);
53+
$serializer = $this->createMock(SerializerInterface::class);
54+
$serializer->expects($this->once())->method('encode')->with($envelope)->willReturn($encoded);
5555

5656
$sender = new DoctrineSender($connection, $serializer);
5757
$sender->send($envelope);

Tests/Transport/DoctrineTransportTest.php

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

@@ -46,7 +46,7 @@ public function testReceivesMessages()
4646
'headers' => ['my' => 'header'],
4747
];
4848

49-
$serializer->method('decode')->with(['body' => 'body', 'headers' => ['my' => 'header']])->willReturn(new Envelope($decodedMessage));
49+
$serializer->expects($this->once())->method('decode')->with(['body' => 'body', 'headers' => ['my' => 'header']])->willReturn(new Envelope($decodedMessage));
5050
$connection->method('get')->willReturn($doctrineEnvelope);
5151

5252
$envelopes = $transport->get();

0 commit comments

Comments
 (0)