Sokil\Mongo\DatabaseTest::testMapCollectionsToClasses PHP Method

testMapCollectionsToClasses() public method

    public function testMapCollectionsToClasses()
    {
        $this->database->map(array('acmeCollection' => '\\Sokil\\Mongo\\CarsCollection', 'acmeGridfs' => '\\Sokil\\Mongo\\CarPhotosGridFS'));
        // create collection
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarsCollection', $this->database->getCollection('acmeCollection'));
        // create document
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarDocument', $this->database->getCollection('acmeCollection')->createDocument());
        // create grid fs
        $fs = $this->database->getGridFS('acmeGridfs');
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarPhotosGridFS', $fs);
        // create file
        $id = $fs->storeBytes('hello');
        $file = $fs->getFileById($id);
        $this->assertInstanceOf('\\Sokil\\Mongo\\CarPhotoGridFSFile', $file);
        $fs->delete();
    }