Commit bb7452f4 authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-54: Update references to driver classes

As of 0.1.4, driver classes are under the MongoDB\Driver namespace. As of 0.1.5, QueryResult and CommandResult were consolidated into a single Result class.
parent 0cf95ce2
This diff is collapsed.
<?php
namespace MongoDB;
use MongoDB\Driver\WriteResult;
class DeleteResult
{
protected $wr;
public function __construct(\MongoDB\WriteResult $wr)
public function __construct(WriteResult $wr)
{
$this->wr = $wr;
}
......
<?php
namespace MongoDB;
use BSON\ObjectId;
use MongoDB\Driver\WriteResult;
class InsertResult
{
protected $wr;
public function __construct(\MongoDB\WriteResult $wr, \BSON\ObjectId $id = null)
public function __construct(WriteResult $wr, ObjectId $id = null)
{
$this->wr = $wr;
$this->id = $id;
......
<?php
namespace MongoDB;
use MongoDB\Driver\WriteResult;
class UpdateResult
{
protected $wr;
public function __construct(\MongoDB\WriteResult $wr)
public function __construct(WriteResult $wr)
{
$this->wr = $wr;
}
......
<?php
use MongoDB\Collection;
use MongoDB\Driver\Manager;
class CollectionTest extends PHPUnit_Framework_TestCase {
function setUp() {
......@@ -6,8 +10,8 @@ class CollectionTest extends PHPUnit_Framework_TestCase {
$this->faker = Faker\Factory::create();
$this->faker->seed(1234);
$this->manager = new MongoDB\Manager("mongodb://localhost");
$this->collection = new MongoDB\Collection($this->manager, "test.case");
$this->manager = new Manager("mongodb://localhost");
$this->collection = new Collection($this->manager, "test.case");
$this->collection->deleteMany(array());
}
......@@ -17,8 +21,8 @@ class CollectionTest extends PHPUnit_Framework_TestCase {
for($i=0; $i<10;$i++) {
$user = createUser($this->faker);
$result = $collection->insertOne($user);
$this->assertInstanceOf("MongoDB\\InsertResult", $result);
$this->assertInstanceOf("BSON\ObjectId", $result->getInsertedId());
$this->assertInstanceOf('MongoDB\InsertResult', $result);
$this->assertInstanceOf('BSON\ObjectId', $result->getInsertedId());
$this->assertEquals(24, strlen($result->getInsertedId()));
$user["_id"] = $result->getInsertedId();
......@@ -33,7 +37,7 @@ class CollectionTest extends PHPUnit_Framework_TestCase {
$count = $collection->count($query);
$this->assertEquals(1, $count);
$cursor = $collection->find($query);
$this->assertInstanceOf("MongoDB\\QueryResult", $cursor);
$this->assertInstanceOf('MongoDB\Driver\Result', $cursor);
foreach($cursor as $n => $person) {
$this->assertInternalType("array", $person);
......
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