Skip to content

Commit 7c17b34

Browse files
committed
Unit tests for ListDatabases and ListIndexes options
1 parent 5c7ce60 commit 7c17b34

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

tests/Operation/ListDatabasesTest.php

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

tests/Operation/ListIndexesTest.php

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

0 commit comments

Comments
 (0)