/**
  * @depends testDropExistingDatabase
  */
 public function testDropNonexistentDatabase()
 {
     $server = $this->getPrimaryServer();
     $operation = new DropDatabase($this->getDatabaseName());
     $operation->execute($server);
     $this->assertDatabaseDoesNotExist($server, $this->getDatabaseName());
     $operation = new DropDatabase($this->getDatabaseName());
     $operation->execute($server);
 }
 public function testListCollectionsForNonexistentDatabase()
 {
     $server = $this->getPrimaryServer();
     $operation = new DropDatabase($this->getDatabaseName());
     $operation->execute($server);
     $operation = new ListCollections($this->getDatabaseName());
     $collections = $operation->execute($server);
     $this->assertCount(0, $collections);
 }
 /**
  * Drop a database.
  *
  * @param string $databaseName
  * @return object Command result document
  */
 public function dropDatabase($databaseName)
 {
     $operation = new DropDatabase($databaseName);
     $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
     return $operation->execute($server);
 }
Esempio n. 4
0
 /**
  * Drop this database.
  *
  * @see DropDatabase::__construct() for supported options
  * @param array $options Additional options
  * @return array|object Command result document
  */
 public function drop(array $options = [])
 {
     if (!isset($options['typeMap'])) {
         $options['typeMap'] = $this->typeMap;
     }
     $operation = new DropDatabase($this->databaseName, $options);
     $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
     return $operation->execute($server);
 }