Skip to content

Commit ca9118e

Browse files
committed
Refactor GridFS\Bucket's invalid constructor option test
1 parent bdda485 commit ca9118e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

tests/GridFS/BucketFunctionalTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MongoDB\Tests\GridFS;
44

5-
use MongoDB\GridFS;
5+
use MongoDB\GridFS\Bucket;
66

77
/**
88
* Functional tests for the Bucket class.
@@ -16,15 +16,20 @@ class BucketFunctionalTest extends FunctionalTestCase
1616
*/
1717
public function testConstructorOptionTypeChecks(array $options)
1818
{
19-
new \MongoDB\GridFS\Bucket($this->manager, $this->getDatabaseName(), $options);
19+
new Bucket($this->manager, $this->getDatabaseName(), $options);
2020
}
2121

2222
public function provideInvalidConstructorOptions()
2323
{
2424
$options = [];
25-
$invalidBucketNames = [123, 3.14, true, [], new \stdClass];
26-
$invalidChunkSizes = ['foo', 3.14, true, [], new \stdClass];
2725

26+
foreach ($this->getInvalidStringValues() as $value) {
27+
$options[][] = ['bucketName' => $value];
28+
}
29+
30+
foreach ($this->getInvalidIntegerValues() as $value) {
31+
$options[][] = ['chunkSizeBytes' => $value];
32+
}
2833

2934
foreach ($this->getInvalidReadPreferenceValues() as $value) {
3035
$options[][] = ['readPreference' => $value];
@@ -33,12 +38,6 @@ public function provideInvalidConstructorOptions()
3338
foreach ($this->getInvalidWriteConcernValues() as $value) {
3439
$options[][] = ['writeConcern' => $value];
3540
}
36-
foreach ($invalidBucketNames as $value) {
37-
$options[][] = ['bucketName' => $value];
38-
}
39-
foreach ($invalidChunkSizes as $value) {
40-
$options[][] = ['chunkSizeBytes' => $value];
41-
}
4241

4342
return $options;
4443
}

0 commit comments

Comments
 (0)