Skip to content

Commit 5bb47d7

Browse files
committed
More static functions
1 parent 6de7408 commit 5bb47d7

File tree

8 files changed

+118
-118
lines changed

8 files changed

+118
-118
lines changed

tests/GridFS/BucketFunctionalTest.php

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

tests/GridFS/FunctionalTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function assertStreamContents(string $expectedContents, $stream): void
5353
*
5454
* @return resource
5555
*/
56-
protected function createStream(string $data = '')
56+
protected static function createStream(string $data = '')
5757
{
5858
$stream = fopen('php://temp', 'w+b');
5959
fwrite($stream, $data);

tests/GridFS/ReadableStreamFunctionalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ public static function provideFileIdAndExpectedBytes()
111111
];
112112
}
113113

114-
public function provideFilteredFileIdAndExpectedBytes()
114+
public static function provideFilteredFileIdAndExpectedBytes()
115115
{
116116
return array_filter(
117-
$this->provideFileIdAndExpectedBytes(),
117+
self::provideFileIdAndExpectedBytes(),
118118
fn (array $args) => $args[1] > 0,
119119
);
120120
}

tests/Operation/FunctionalTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function setUp(): void
2222
$this->dropCollection($this->getDatabaseName(), $this->getCollectionName());
2323
}
2424

25-
public function provideFilterDocuments(): array
25+
public static function provideFilterDocuments(): array
2626
{
2727
$expected = (object) ['x' => 1];
2828

@@ -34,7 +34,7 @@ public function provideFilterDocuments(): array
3434
];
3535
}
3636

37-
public function provideReplacementDocuments(): array
37+
public static function provideReplacementDocuments(): array
3838
{
3939
$expected = (object) ['x' => 1];
4040
$expectedEmpty = (object) [];
@@ -53,7 +53,7 @@ public function provideReplacementDocuments(): array
5353
];
5454
}
5555

56-
public function provideUpdateDocuments(): array
56+
public static function provideUpdateDocuments(): array
5757
{
5858
$expected = (object) ['$set' => (object) ['x' => 1]];
5959

@@ -65,7 +65,7 @@ public function provideUpdateDocuments(): array
6565
];
6666
}
6767

68-
public function provideUpdatePipelines(): array
68+
public static function provideUpdatePipelines(): array
6969
{
7070
$expected = [(object) ['$set' => (object) ['x' => 1]]];
7171

tests/Operation/MapReduceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static function provideInvalidConstructorOptions()
8787
]);
8888
}
8989

90-
private function getInvalidJavascriptValues()
90+
private static function getInvalidJavascriptValues()
9191
{
9292
return [123, 3.14, 'foo', true, [], new stdClass(), new ObjectId()];
9393
}

tests/Operation/TestCase.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414
abstract class TestCase extends BaseTestCase
1515
{
16-
public function provideReplacementDocuments(): array
16+
public static function provideReplacementDocuments(): array
1717
{
1818
return [
1919
'replacement:array' => [['x' => 1]],
@@ -29,7 +29,7 @@ public function provideReplacementDocuments(): array
2929
];
3030
}
3131

32-
public function provideUpdateDocuments(): array
32+
public static function provideUpdateDocuments(): array
3333
{
3434
return [
3535
'update:array' => [['$set' => ['x' => 1]]],
@@ -39,7 +39,7 @@ public function provideUpdateDocuments(): array
3939
];
4040
}
4141

42-
public function provideUpdatePipelines(): array
42+
public static function provideUpdatePipelines(): array
4343
{
4444
return [
4545
'pipeline:array' => [[['$set' => ['x' => 1]]]],
@@ -48,7 +48,7 @@ public function provideUpdatePipelines(): array
4848
];
4949
}
5050

51-
public function provideEmptyUpdatePipelines(): array
51+
public static function provideEmptyUpdatePipelines(): array
5252
{
5353
/* Empty update pipelines are accepted by the update and findAndModify
5454
* commands (as NOPs); however, they are not supported for updates in
@@ -65,7 +65,7 @@ public function provideEmptyUpdatePipelines(): array
6565
];
6666
}
6767

68-
public function provideEmptyUpdatePipelinesExcludingArray(): array
68+
public static function provideEmptyUpdatePipelinesExcludingArray(): array
6969
{
7070
/* This data provider is used for replace operations, which accept empty
7171
* arrays as replacement documents for BC. */
@@ -75,12 +75,12 @@ public function provideEmptyUpdatePipelinesExcludingArray(): array
7575
];
7676
}
7777

78-
public function provideInvalidUpdateValues(): array
78+
public static function provideInvalidUpdateValues(): array
7979
{
8080
return self::wrapValuesForDataProvider(self::getInvalidUpdateValues());
8181
}
8282

83-
protected function getInvalidUpdateValues(): array
83+
protected static function getInvalidUpdateValues(): array
8484
{
8585
return [123, 3.14, 'foo', true];
8686
}

tests/Operation/WatchTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testConstructorRejectsCodecAndTypemap(): void
6666
new Watch($this->manager, $this->getDatabaseName(), $this->getCollectionName(), [], $options);
6767
}
6868

69-
private function getInvalidTimestampValues()
69+
private static function getInvalidTimestampValues()
7070
{
7171
return [123, 3.14, 'foo', true, [], new stdClass()];
7272
}

tests/UnifiedSpecTests/UnifiedSpecTest.php

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ public function testAtlasDataLake(UnifiedTestCase $test): void
234234
self::$runner->run($test);
235235
}
236236

237-
public function provideAtlasDataLakeTests()
237+
public static function provideAtlasDataLakeTests(): Generator
238238
{
239-
return $this->provideTests(__DIR__ . '/atlas-data-lake/*.json');
239+
return self::provideTests(__DIR__ . '/atlas-data-lake/*.json');
240240
}
241241

242242
/**
@@ -248,9 +248,9 @@ public function testChangeStreams(UnifiedTestCase $test): void
248248
self::$runner->run($test);
249249
}
250250

251-
public function provideChangeStreamsTests()
251+
public static function provideChangeStreamsTests(): Generator
252252
{
253-
return $this->provideTests(__DIR__ . '/change-streams/*.json');
253+
return self::provideTests(__DIR__ . '/change-streams/*.json');
254254
}
255255

256256
/**
@@ -263,9 +263,9 @@ public function testClientSideEncryption(UnifiedTestCase $test): void
263263
self::$runner->run($test);
264264
}
265265

266-
public function provideClientSideEncryptionTests()
266+
public static function provideClientSideEncryptionTests(): Generator
267267
{
268-
return $this->provideTests(__DIR__ . '/client-side-encryption/*.json');
268+
return self::provideTests(__DIR__ . '/client-side-encryption/*.json');
269269
}
270270

271271
/**
@@ -277,9 +277,9 @@ public function testCollectionManagement(UnifiedTestCase $test): void
277277
self::$runner->run($test);
278278
}
279279

280-
public function provideCollectionManagementTests()
280+
public static function provideCollectionManagementTests(): Generator
281281
{
282-
return $this->provideTests(__DIR__ . '/collection-management/*.json');
282+
return self::provideTests(__DIR__ . '/collection-management/*.json');
283283
}
284284

285285
/**
@@ -291,9 +291,9 @@ public function testCommandMonitoring(UnifiedTestCase $test): void
291291
self::$runner->run($test);
292292
}
293293

294-
public function provideCommandMonitoringTests()
294+
public static function provideCommandMonitoringTests(): Generator
295295
{
296-
return $this->provideTests(__DIR__ . '/command-monitoring/*.json');
296+
return self::provideTests(__DIR__ . '/command-monitoring/*.json');
297297
}
298298

299299
/**
@@ -305,9 +305,9 @@ public function testCrud(UnifiedTestCase $test): void
305305
self::$runner->run($test);
306306
}
307307

308-
public function provideCrudTests()
308+
public static function provideCrudTests(): Generator
309309
{
310-
return $this->provideTests(__DIR__ . '/crud/*.json');
310+
return self::provideTests(__DIR__ . '/crud/*.json');
311311
}
312312

313313
/**
@@ -319,9 +319,9 @@ public function testGridFS(UnifiedTestCase $test): void
319319
self::$runner->run($test);
320320
}
321321

322-
public function provideGridFSTests()
322+
public static function provideGridFSTests(): Generator
323323
{
324-
return $this->provideTests(__DIR__ . '/gridfs/*.json');
324+
return self::provideTests(__DIR__ . '/gridfs/*.json');
325325
}
326326

327327
/**
@@ -333,9 +333,9 @@ public function testLoadBalancers(UnifiedTestCase $test): void
333333
self::$runner->run($test);
334334
}
335335

336-
public function provideLoadBalancers()
336+
public static function provideLoadBalancers(): Generator
337337
{
338-
return $this->provideTests(__DIR__ . '/load-balancers/*.json');
338+
return self::provideTests(__DIR__ . '/load-balancers/*.json');
339339
}
340340

341341
/** @dataProvider provideReadWriteConcernTests */
@@ -344,9 +344,9 @@ public function testReadWriteConcern(UnifiedTestCase $test): void
344344
self::$runner->run($test);
345345
}
346346

347-
public function provideReadWriteConcernTests()
347+
public static function provideReadWriteConcernTests(): Generator
348348
{
349-
return $this->provideTests(__DIR__ . '/read-write-concern/*.json');
349+
return self::provideTests(__DIR__ . '/read-write-concern/*.json');
350350
}
351351

352352
/**
@@ -358,9 +358,9 @@ public function testRetryableReads(UnifiedTestCase $test): void
358358
self::$runner->run($test);
359359
}
360360

361-
public function provideRetryableReadsTests()
361+
public static function provideRetryableReadsTests(): Generator
362362
{
363-
return $this->provideTests(__DIR__ . '/retryable-reads/*.json');
363+
return self::provideTests(__DIR__ . '/retryable-reads/*.json');
364364
}
365365

366366
/**
@@ -372,9 +372,9 @@ public function testRetryableWrites(UnifiedTestCase $test): void
372372
self::$runner->run($test);
373373
}
374374

375-
public function provideRetryableWritesTests()
375+
public static function provideRetryableWritesTests(): Generator
376376
{
377-
return $this->provideTests(__DIR__ . '/retryable-writes/*.json');
377+
return self::provideTests(__DIR__ . '/retryable-writes/*.json');
378378
}
379379

380380
/**
@@ -386,9 +386,9 @@ public function testRunCommand(UnifiedTestCase $test): void
386386
self::$runner->run($test);
387387
}
388388

389-
public function provideRunCommandTests()
389+
public static function provideRunCommandTests(): Generator
390390
{
391-
return $this->provideTests(__DIR__ . '/run-command/*.json');
391+
return self::provideTests(__DIR__ . '/run-command/*.json');
392392
}
393393

394394
/**
@@ -400,9 +400,9 @@ public function testSessions(UnifiedTestCase $test): void
400400
self::$runner->run($test);
401401
}
402402

403-
public function provideSessionsTests()
403+
public static function provideSessionsTests(): Generator
404404
{
405-
return $this->provideTests(__DIR__ . '/sessions/*.json');
405+
return self::provideTests(__DIR__ . '/sessions/*.json');
406406
}
407407

408408
/**
@@ -414,9 +414,9 @@ public function testTransactions(UnifiedTestCase $test): void
414414
self::$runner->run($test);
415415
}
416416

417-
public function provideTransactionsTests()
417+
public static function provideTransactionsTests(): Generator
418418
{
419-
return $this->provideTests(__DIR__ . '/transactions/*.json');
419+
return self::provideTests(__DIR__ . '/transactions/*.json');
420420
}
421421

422422
/** @dataProvider provideTransactionsConvenientApiTests */
@@ -425,9 +425,9 @@ public function testTransactionsConvenientApi(UnifiedTestCase $test): void
425425
self::$runner->run($test);
426426
}
427427

428-
public function provideTransactionsConvenientApiTests()
428+
public static function provideTransactionsConvenientApiTests(): Generator
429429
{
430-
return $this->provideTests(__DIR__ . '/transactions-convenient-api/*.json');
430+
return self::provideTests(__DIR__ . '/transactions-convenient-api/*.json');
431431
}
432432

433433
/**
@@ -440,9 +440,9 @@ public function testVersionedApi(UnifiedTestCase $test): void
440440
self::$runner->run($test);
441441
}
442442

443-
public function provideVersionedApiTests()
443+
public static function provideVersionedApiTests(): Generator
444444
{
445-
return $this->provideTests(__DIR__ . '/versioned-api/*.json');
445+
return self::provideTests(__DIR__ . '/versioned-api/*.json');
446446
}
447447

448448
/** @dataProvider providePassingTests */
@@ -451,9 +451,9 @@ public function testPassingTests(UnifiedTestCase $test): void
451451
self::$runner->run($test);
452452
}
453453

454-
public function providePassingTests()
454+
public static function providePassingTests(): Generator
455455
{
456-
yield from $this->provideTests(__DIR__ . '/valid-pass/*.json');
456+
yield from self::provideTests(__DIR__ . '/valid-pass/*.json');
457457
}
458458

459459
/** @dataProvider provideFailingTests */
@@ -489,9 +489,9 @@ public function testFailingTests(UnifiedTestCase $test): void
489489
$this->assertTrue($failed, 'Expected test to throw an exception');
490490
}
491491

492-
public function provideFailingTests()
492+
public static function provideFailingTests(): Generator
493493
{
494-
yield from $this->provideTests(__DIR__ . '/valid-fail/*.json');
494+
yield from self::provideTests(__DIR__ . '/valid-fail/*.json');
495495
}
496496

497497
/** @dataProvider provideIndexManagementTests */
@@ -508,12 +508,12 @@ public function testIndexManagement(UnifiedTestCase $test): void
508508
self::$runner->run($test);
509509
}
510510

511-
public function provideIndexManagementTests()
511+
public static function provideIndexManagementTests(): Generator
512512
{
513-
yield from $this->provideTests(__DIR__ . '/index-management/*.json');
513+
yield from self::provideTests(__DIR__ . '/index-management/*.json');
514514
}
515515

516-
private function provideTests(string $pattern): Generator
516+
private static function provideTests(string $pattern): Generator
517517
{
518518
foreach (glob($pattern) as $filename) {
519519
$group = basename(dirname($filename));

0 commit comments

Comments
 (0)