Commit 5c7ce60a authored by Jeremy Mikola's avatar Jeremy Mikola

Test for invalid typeMap options

parent e4511d9a
...@@ -19,6 +19,26 @@ class ClientTest extends TestCase ...@@ -19,6 +19,26 @@ class ClientTest extends TestCase
$this->assertEquals('mongodb://localhost:27017', (string) $client); $this->assertEquals('mongodb://localhost:27017', (string) $client);
} }
/**
* @expectedException MongoDB\Exception\InvalidArgumentException
* @dataProvider provideInvalidConstructorDriverOptions
*/
public function testConstructorDriverOptionTypeChecks(array $driverOptions)
{
new Client($this->getUri(), [], $driverOptions);
}
public function provideInvalidConstructorDriverOptions()
{
$options = [];
foreach ($this->getInvalidArrayValues() as $value) {
$options[][] = ['typeMap' => $value];
}
return $options;
}
public function testToString() public function testToString()
{ {
$client = new Client($this->getUri()); $client = new Client($this->getUri());
......
...@@ -55,6 +55,10 @@ class CollectionFunctionalTest extends FunctionalTestCase ...@@ -55,6 +55,10 @@ class CollectionFunctionalTest extends FunctionalTestCase
$options[][] = ['readPreference' => $value]; $options[][] = ['readPreference' => $value];
} }
foreach ($this->getInvalidArrayValues() as $value) {
$options[][] = ['typeMap' => $value];
}
foreach ($this->getInvalidWriteConcernValues() as $value) { foreach ($this->getInvalidWriteConcernValues() as $value) {
$options[][] = ['writeConcern' => $value]; $options[][] = ['writeConcern' => $value];
} }
......
...@@ -52,6 +52,10 @@ class DatabaseFunctionalTest extends FunctionalTestCase ...@@ -52,6 +52,10 @@ class DatabaseFunctionalTest extends FunctionalTestCase
$options[][] = ['readPreference' => $value]; $options[][] = ['readPreference' => $value];
} }
foreach ($this->getInvalidArrayValues() as $value) {
$options[][] = ['typeMap' => $value];
}
foreach ($this->getInvalidWriteConcernValues() as $value) { foreach ($this->getInvalidWriteConcernValues() as $value) {
$options[][] = ['writeConcern' => $value]; $options[][] = ['writeConcern' => $value];
} }
......
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