Sokil\Mongo\CollectionTest::testInitIndexes PHP Method

testInitIndexes() public method

public testInitIndexes ( )
    public function testInitIndexes()
    {
        $reflection = new \ReflectionClass($this->collection);
        $property = $reflection->getProperty('definition');
        $property->setAccessible(true);
        $definition = $property->getValue($this->collection);
        $definition->setOption('index', array(array('keys' => array('asc' => 1, 'desc' => -1), 'unique' => true)));
        $this->collection->initIndexes();
        $indexes = $this->collection->getIndexes();
        $this->assertEquals(array('asc' => 1, 'desc' => -1), $indexes[1]['key']);
        $this->assertArrayHasKey('unique', $indexes[1]);
    }
CollectionTest