Skip to content

Commit 9598cd7

Browse files
committed
Add return types to test methods
1 parent 3d3c909 commit 9598cd7

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

tests/Unit/Connectors/PubSubConnectorTests.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
class PubSubConnectorTests extends TestCase
1212
{
13-
public function testImplementsConnectorInterface()
13+
public function testImplementsConnectorInterface(): void
1414
{
1515
putenv('SUPPRESS_GCLOUD_CREDS_WARNING=true');
1616
$reflection = new ReflectionClass(PubSubConnector::class);
1717
$this->assertTrue($reflection->implementsInterface(ConnectorInterface::class));
1818
}
1919

20-
public function testConnectReturnsPubSubQueueInstance()
20+
public function testConnectReturnsPubSubQueueInstance(): void
2121
{
2222
$connector = new PubSubConnector;
2323
$config = $this->createFakeConfig();
@@ -27,7 +27,7 @@ public function testConnectReturnsPubSubQueueInstance()
2727
$this->assertEquals($queue->getSubscriberName(), 'test-subscriber');
2828
}
2929

30-
public function testQueuePrefixAdded()
30+
public function testQueuePrefixAdded(): void
3131
{
3232
$connector = new PubSubConnector();
3333
$config = $this->createFakeConfig() + ['queue_prefix' => 'prefix-'];
@@ -36,7 +36,7 @@ public function testQueuePrefixAdded()
3636
$this->assertEquals('prefix-my-queue', $queue->getQueue('my-queue'));
3737
}
3838

39-
public function testNotQueuePrefixAddedMultipleTimes()
39+
public function testNotQueuePrefixAddedMultipleTimes(): void
4040
{
4141
$connector = new PubSubConnector();
4242
$config = $this->createFakeConfig() + ['queue_prefix' => 'prefix-'];

tests/Unit/Jobs/PubSubJobTests.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,34 +84,34 @@ protected function setUp(): void
8484
->getMock();
8585
}
8686

87-
public function testImplementsJobInterface()
87+
public function testImplementsJobInterface(): void
8888
{
8989
$reflection = new ReflectionClass(PubSubJob::class);
9090
$this->assertTrue($reflection->implementsInterface(JobContract::class));
9191
}
9292

93-
public function testGetJobId()
93+
public function testGetJobId(): void
9494
{
9595
$this->assertEquals($this->job->getJobId(), $this->messageId);
9696
}
9797

98-
public function testGetRawBody()
98+
public function testGetRawBody(): void
9999
{
100100
$this->assertEquals($this->job->getRawBody(), $this->messageData);
101101
}
102102

103-
public function testDeleteMethodSetDeletedProperty()
103+
public function testDeleteMethodSetDeletedProperty(): void
104104
{
105105
$this->job->delete();
106106
$this->assertTrue($this->job->isDeleted());
107107
}
108108

109-
public function testAttempts()
109+
public function testAttempts(): void
110110
{
111111
$this->assertTrue(is_int($this->job->attempts()));
112112
}
113113

114-
public function testReleaseAndPublish()
114+
public function testReleaseAndPublish(): void
115115
{
116116
$this->queue->expects($this->once())
117117
->method('republish')
@@ -136,7 +136,7 @@ public function testReleaseAndPublish()
136136
$this->job->release();
137137
}
138138

139-
public function testReleaseMethodSetReleasedProperty()
139+
public function testReleaseMethodSetReleasedProperty(): void
140140
{
141141
$this->job->release();
142142
$this->assertTrue($this->job->isReleased());

tests/Unit/PubSubQueueTests.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ protected function setUp(): void
6767
])->getMock();
6868
}
6969

70-
public function testImplementsQueueInterface()
70+
public function testImplementsQueueInterface(): void
7171
{
7272
$reflection = new ReflectionClass(PubSubQueue::class);
7373
$this->assertTrue($reflection->implementsInterface(QueueContract::class));
7474
}
7575

76-
public function testPushNewJob()
76+
public function testPushNewJob(): void
7777
{
7878
$job = 'test';
7979
$data = ['foo' => 'bar'];
@@ -90,7 +90,7 @@ public function testPushNewJob()
9090
$this->assertEquals($this->expectedResult, $this->queue->push('test', $data));
9191
}
9292

93-
public function testPushRaw()
93+
public function testPushRaw(): void
9494
{
9595
$queue = $this->getMockBuilder(PubSubQueue::class)
9696
->setConstructorArgs([$this->client, 'default'])
@@ -116,7 +116,7 @@ public function testPushRaw()
116116
$this->assertEquals($this->expectedResult, $queue->pushRaw($payload));
117117
}
118118

119-
public function testPushRawOptionsOnlyAcceptKeyValueStrings()
119+
public function testPushRawOptionsOnlyAcceptKeyValueStrings(): void
120120
{
121121
$this->expectException(\UnexpectedValueException::class);
122122

@@ -148,7 +148,7 @@ public function testPushRawOptionsOnlyAcceptKeyValueStrings()
148148
$queue->pushRaw($payload, '', $options);
149149
}
150150

151-
public function testLater()
151+
public function testLater(): void
152152
{
153153
$job = 'test';
154154
$delay = 60;
@@ -185,7 +185,7 @@ public function testLater()
185185
$this->assertEquals($this->expectedResult, $this->queue->later($delay, $job, ['foo' => 'bar']));
186186
}
187187

188-
public function testPopWhenJobsAvailable()
188+
public function testPopWhenJobsAvailable(): void
189189
{
190190
$this->subscription->expects($this->once())
191191
->method('acknowledge');
@@ -210,7 +210,7 @@ public function testPopWhenJobsAvailable()
210210
$this->assertTrue($this->queue->pop('test') instanceof PubSubJob);
211211
}
212212

213-
public function testPopWhenNoJobAvailable()
213+
public function testPopWhenNoJobAvailable(): void
214214
{
215215
$this->subscription->expects($this->exactly(0))
216216
->method('acknowledge');
@@ -230,7 +230,7 @@ public function testPopWhenNoJobAvailable()
230230
$this->assertTrue(is_null($this->queue->pop('test')));
231231
}
232232

233-
public function testPopWhenTopicDoesNotExist()
233+
public function testPopWhenTopicDoesNotExist(): void
234234
{
235235
$this->queue->method('getTopic')
236236
->willReturn($this->topic);
@@ -241,7 +241,7 @@ public function testPopWhenTopicDoesNotExist()
241241
$this->assertTrue(is_null($this->queue->pop('test')));
242242
}
243243

244-
public function testPopWhenJobDelayed()
244+
public function testPopWhenJobDelayed(): void
245245
{
246246
$delay = 60;
247247
$timestamp = Carbon::now()->addSeconds($delay)->getTimestamp();
@@ -266,7 +266,7 @@ public function testPopWhenJobDelayed()
266266
$this->assertTrue(is_null($this->queue->pop('test')));
267267
}
268268

269-
public function testBulk()
269+
public function testBulk(): void
270270
{
271271
$jobs = ['test'];
272272
$data = ['foo' => 'bar'];
@@ -289,7 +289,7 @@ public function testBulk()
289289
$this->assertEquals($this->expectedResult, $this->queue->bulk($jobs, $data));
290290
}
291291

292-
public function testAcknowledge()
292+
public function testAcknowledge(): void
293293
{
294294
$this->subscription->expects($this->once())
295295
->method('acknowledge');
@@ -303,7 +303,7 @@ public function testAcknowledge()
303303
$this->queue->acknowledge($this->message);
304304
}
305305

306-
public function testRepublish()
306+
public function testRepublish(): void
307307
{
308308
$options = ['foo' => 'bar'];
309309
$delay = 60;
@@ -358,7 +358,7 @@ public function testRepublish()
358358
$this->queue->republish($this->message, 'test', $options, $delay);
359359
}
360360

361-
public function testRepublishOptionsOnlyAcceptString()
361+
public function testRepublishOptionsOnlyAcceptString(): void
362362
{
363363
$this->expectException(\UnexpectedValueException::class);
364364

@@ -389,7 +389,7 @@ public function testRepublishOptionsOnlyAcceptString()
389389
$this->queue->republish($this->message, 'test', $options, $delay);
390390
}
391391

392-
public function testGetTopic()
392+
public function testGetTopic(): void
393393
{
394394
$this->topic->method('exists')
395395
->willReturn(true);
@@ -405,7 +405,7 @@ public function testGetTopic()
405405
$this->assertTrue($queue->getTopic('test') instanceof Topic);
406406
}
407407

408-
public function testCreateTopicAndReturnIt()
408+
public function testCreateTopicAndReturnIt(): void
409409
{
410410
$this->topic->method('exists')
411411
->willReturn(false);
@@ -425,7 +425,7 @@ public function testCreateTopicAndReturnIt()
425425
$this->assertTrue($queue->getTopic('test', true) instanceof Topic);
426426
}
427427

428-
public function testSubscribtionIsCreated()
428+
public function testSubscribtionIsCreated(): void
429429
{
430430
$this->topic->method('subscription')
431431
->willReturn($this->subscription);
@@ -444,7 +444,7 @@ public function testSubscribtionIsCreated()
444444
$this->assertTrue($queue->subscribeToTopic($this->topic) instanceof Subscription);
445445
}
446446

447-
public function testSubscriptionIsRetrieved()
447+
public function testSubscriptionIsRetrieved(): void
448448
{
449449
$this->topic->method('subscription')
450450
->willReturn($this->subscription);
@@ -460,7 +460,7 @@ public function testSubscriptionIsRetrieved()
460460
$this->assertTrue($queue->subscribeToTopic($this->topic) instanceof Subscription);
461461
}
462462

463-
public function testGetSubscriberName()
463+
public function testGetSubscriberName(): void
464464
{
465465
$queue = $this->getMockBuilder(PubSubQueue::class)
466466
->setConstructorArgs([$this->client, 'default', 'test-subscriber'])
@@ -471,7 +471,7 @@ public function testGetSubscriberName()
471471
$this->assertEquals($queue->getSubscriberName(), 'test-subscriber');
472472
}
473473

474-
public function testGetPubSub()
474+
public function testGetPubSub(): void
475475
{
476476
$this->assertTrue($this->queue->getPubSub() instanceof PubSubClient);
477477
}

0 commit comments

Comments
 (0)