Alcaeus\MongoDbAdapter\Tests\Mongo\MongoDBTest::testCreateCollection PHP Метод

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

    public function testCreateCollection()
    {
        $database = $this->getDatabase();
        $collection = $database->createCollection('test', ['capped' => true, 'size' => 100]);
        $this->assertInstanceOf('MongoCollection', $collection);
        $document = ['foo' => 'bar'];
        $collection->insert($document);
        $checkDatabase = $this->getCheckDatabase();
        foreach ($checkDatabase->listCollections() as $collectionInfo) {
            if ($collectionInfo->getName() === 'test') {
                $this->assertTrue($collectionInfo->isCapped());
                return;
            }
        }
    }