ListDatabasesTest.php 1.03 KB
Newer Older
1 2 3 4
<?php

namespace MongoDB\Tests\Operation;

5
use MongoDB\Exception\InvalidArgumentException;
6 7 8 9 10 11 12 13 14
use MongoDB\Operation\ListDatabases;

class ListDatabasesTest extends TestCase
{
    /**
     * @dataProvider provideInvalidConstructorOptions
     */
    public function testConstructorOptionTypeChecks(array $options)
    {
15
        $this->expectException(InvalidArgumentException::class);
16 17 18 19 20 21 22
        new ListDatabases($options);
    }

    public function provideInvalidConstructorOptions()
    {
        $options = [];

23 24 25 26
        foreach ($this->getInvalidBooleanValues() as $value) {
            $options[][] = ['authorizedDatabases' => $value];
        }

27 28 29 30
        foreach ($this->getInvalidDocumentValues() as $value) {
            $options[][] = ['filter' => $value];
        }

31 32 33 34
        foreach ($this->getInvalidIntegerValues() as $value) {
            $options[][] = ['maxTimeMS' => $value];
        }

35 36 37 38
        foreach ($this->getInvalidSessionValues() as $value) {
            $options[][] = ['session' => $value];
        }

39 40 41
        return $options;
    }
}