Commit 3db125f1 authored by Jeremy Mikola's avatar Jeremy Mikola

Merge pull request #5

parents 27543788 ea6da09f
......@@ -2,9 +2,10 @@
namespace MongoDB;
use MongoDB\Driver\Manager;
use MongoDB\Database;
use MongoDB\Collection;
use MongoDB\Database;
use MongoDB\Driver\Manager;
use MongoDB\Driver\Result;
class Client
{
......@@ -29,6 +30,17 @@ class Client
$this->manager = new Manager($uri, $options, $driverOptions);
}
/**
* Drop a database.
*
* @param string $databaseName
* @return Result
*/
public function dropDatabase($databaseName)
{
// TODO
}
/**
* Select a database
*
......
This diff is collapsed.
......@@ -2,8 +2,9 @@
namespace MongoDB;
use MongoDB\Driver\Manager;
use MongoDB\Collection;
use MongoDB\Driver\Manager;
use MongoDB\Driver\Result;
class Database
{
......@@ -32,6 +33,53 @@ class Database
$this->rp = $rp;
}
/**
* Create a new collection explicitly.
*
* @see http://docs.mongodb.org/manual/reference/command/create/
* @see http://docs.mongodb.org/manual/reference/method/db.createCollection/
* @param string $collectionName
* @param array $options
* @return Result
*/
public function createCollection($collectionName, array $options = array())
{
// TODO
}
/**
* Drop this database.
*
* @return Result
*/
public function drop()
{
// TODO
}
/**
* Drop a collection within this database.
*
* @param string $collectionName
* @return Result
*/
public function dropCollection($collectionName)
{
// TODO
}
/**
* Returns information for all collections in this database.
*
* @see http://docs.mongodb.org/manual/reference/command/listCollections/
* @param array $options
* @return Result
*/
public function listCollections(array $options = array())
{
// TODO
}
/**
* Select a specific collection in this database
*
......
......@@ -6,7 +6,7 @@ use MongoDB\Driver\Manager;
class CollectionTest extends PHPUnit_Framework_TestCase {
function setUp() {
require __DIR__ . "/" . "utils.inc";
require_once __DIR__ . "/" . "utils.inc";
$this->faker = Faker\Factory::create();
$this->faker->seed(1234);
......@@ -44,5 +44,28 @@ class CollectionTest extends PHPUnit_Framework_TestCase {
}
$this->assertEquals(0, $n);
}
public function testMethodOrder()
{
$class = new ReflectionClass('MongoDB\Collection');
$filters = array(
'public' => ReflectionMethod::IS_PUBLIC,
'protected' => ReflectionMethod::IS_PROTECTED,
'private' => ReflectionMethod::IS_PRIVATE,
);
foreach ($filters as $visibility => $filter) {
$methods = array_map(
function(ReflectionMethod $method) { return $method->getName(); },
$class->getMethods($filter)
);
$sortedMethods = $methods;
sort($sortedMethods);
$this->assertEquals($methods, $sortedMethods, sprintf('%s methods are declared alphabetically', ucfirst($visibility)));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment