Sokil\Mongo\DatabaseTest::testMapCollectionToClass PHP Метод

testMapCollectionToClass() публичный Метод

    public function testMapCollectionToClass()
    {
        $this->database->map('acmeCollection', '\\Sokil\\Mongo\\CarsCollection');
        $this->database->map('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();
    }