Commit ca9118ee authored by Jeremy Mikola's avatar Jeremy Mikola

Refactor GridFS\Bucket's invalid constructor option test

parent bdda4858
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace MongoDB\Tests\GridFS; namespace MongoDB\Tests\GridFS;
use MongoDB\GridFS; use MongoDB\GridFS\Bucket;
/** /**
* Functional tests for the Bucket class. * Functional tests for the Bucket class.
...@@ -16,15 +16,20 @@ class BucketFunctionalTest extends FunctionalTestCase ...@@ -16,15 +16,20 @@ class BucketFunctionalTest extends FunctionalTestCase
*/ */
public function testConstructorOptionTypeChecks(array $options) public function testConstructorOptionTypeChecks(array $options)
{ {
new \MongoDB\GridFS\Bucket($this->manager, $this->getDatabaseName(), $options); new Bucket($this->manager, $this->getDatabaseName(), $options);
} }
public function provideInvalidConstructorOptions() public function provideInvalidConstructorOptions()
{ {
$options = []; $options = [];
$invalidBucketNames = [123, 3.14, true, [], new \stdClass];
$invalidChunkSizes = ['foo', 3.14, true, [], new \stdClass];
foreach ($this->getInvalidStringValues() as $value) {
$options[][] = ['bucketName' => $value];
}
foreach ($this->getInvalidIntegerValues() as $value) {
$options[][] = ['chunkSizeBytes' => $value];
}
foreach ($this->getInvalidReadPreferenceValues() as $value) { foreach ($this->getInvalidReadPreferenceValues() as $value) {
$options[][] = ['readPreference' => $value]; $options[][] = ['readPreference' => $value];
...@@ -33,12 +38,6 @@ class BucketFunctionalTest extends FunctionalTestCase ...@@ -33,12 +38,6 @@ class BucketFunctionalTest extends FunctionalTestCase
foreach ($this->getInvalidWriteConcernValues() as $value) { foreach ($this->getInvalidWriteConcernValues() as $value) {
$options[][] = ['writeConcern' => $value]; $options[][] = ['writeConcern' => $value];
} }
foreach ($invalidBucketNames as $value) {
$options[][] = ['bucketName' => $value];
}
foreach ($invalidChunkSizes as $value) {
$options[][] = ['chunkSizeBytes' => $value];
}
return $options; return $options;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment