Skip to content

Commit 8b80804

Browse files
committed
Create test for ListCollections constructor options
1 parent 971545c commit 8b80804

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/Operation/CreateIndexes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
namespace MongoDB\Operation;
1919

20+
use MongoDB\Driver\BulkWrite as Bulk;
2021
use MongoDB\Driver\Command;
2122
use MongoDB\Driver\Server;
2223
use MongoDB\Driver\WriteConcern;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace MongoDB\Tests\Operation;
4+
5+
use MongoDB\Operation\ListCollections;
6+
7+
class ListCollectionsTest extends TestCase
8+
{
9+
/**
10+
* @expectedException MongoDB\Exception\InvalidArgumentException
11+
* @dataProvider provideInvalidConstructorOptions
12+
*/
13+
public function testConstructorOptionTypeChecks(array $options)
14+
{
15+
new ListCollections($this->getDatabaseName(), $options);
16+
}
17+
18+
public function provideInvalidConstructorOptions()
19+
{
20+
$options = [];
21+
22+
foreach ($this->getInvalidDocumentValues() as $value) {
23+
$options[][] = ['filter' => $value];
24+
}
25+
26+
foreach ($this->getInvalidIntegerValues() as $value) {
27+
$options[][] = ['maxTimeMS' => $value];
28+
}
29+
30+
return $options;
31+
}
32+
}

0 commit comments

Comments
 (0)