Sokil\Mongo\DatabaseTest::testMapRegexpCollectionNameToClass PHP Method

testMapRegexpCollectionNameToClass() public method

    public function testMapRegexpCollectionNameToClass()
    {
        $this->database->map('/littleCar(\\d)/', '\\Sokil\\Mongo\\CarsCollection');
        $this->database->map(array('/bigCar(\\d+)/' => '\\Sokil\\Mongo\\CarsCollection'));
        $collection = $this->database->getCollection('littleCar5');
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarsCollection', $collection);
        $this->assertEquals(array('littleCar5', 5), $collection->getOption('regexp'));
        $collection = $this->database->getCollection('bigCar42');
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarsCollection', $collection);
        $this->assertEquals(array('bigCar42', 42), $collection->getOption('regexp'));
    }