Commit 44e59fed authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-280: Rename ObjectID to ObjectId

parent dcb4ccaa
...@@ -3,7 +3,7 @@ name: _id ...@@ -3,7 +3,7 @@ name: _id
type: mixed type: mixed
description: | description: |
Value to use as the file document identifier. Defaults to a new Value to use as the file document identifier. Defaults to a new
:php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` object. :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>` object.
interface: phpmethod interface: phpmethod
operation: ~ operation: ~
optional: true optional: true
......
...@@ -7,6 +7,6 @@ content: | ...@@ -7,6 +7,6 @@ content: |
<manual/en/language.types.type-juggling.php>` rules. When matching a special <manual/en/language.types.type-juggling.php>` rules. When matching a special
BSON type the query criteria should use the respective :php:`BSON class BSON type the query criteria should use the respective :php:`BSON class
<manual/en/book.bson.php>` in the driver (e.g. use <manual/en/book.bson.php>` in the driver (e.g. use
:php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` to match an :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>` to match an
:manual:`ObjectId </reference/object-id/>`). :manual:`ObjectId </reference/object-id/>`).
... ...
...@@ -124,7 +124,7 @@ Consider the following class definition: ...@@ -124,7 +124,7 @@ Consider the following class definition:
public function __construct($name) public function __construct($name)
{ {
$this->id = new MongoDB\BSON\ObjectID; $this->id = new MongoDB\BSON\ObjectId;
$this->name = (string) $name; $this->name = (string) $name;
$this->createdAt = new MongoDB\BSON\UTCDateTime; $this->createdAt = new MongoDB\BSON\UTCDateTime;
} }
...@@ -167,7 +167,7 @@ The output would then resemble: ...@@ -167,7 +167,7 @@ The output would then resemble:
object(Person)#18 (3) { object(Person)#18 (3) {
["id":"Person":private]=> ["id":"Person":private]=>
object(MongoDB\BSON\ObjectID)#15 (1) { object(MongoDB\BSON\ObjectId)#15 (1) {
["oid"]=> ["oid"]=>
string(24) "56fad2c36118fd2e9820cfc1" string(24) "56fad2c36118fd2e9820cfc1"
} }
......
...@@ -34,5 +34,5 @@ insert operations in the bulk write. ...@@ -34,5 +34,5 @@ insert operations in the bulk write.
The index of each ID in the map corresponds to each document's position in the The index of each ID in the map corresponds to each document's position in the
bulk operation. If a document had an ID prior to inserting (i.e. the driver did bulk operation. If a document had an ID prior to inserting (i.e. the driver did
not generate an ID), the index will contain its ``_id`` field value. Any not generate an ID), the index will contain its ``_id`` field value. Any
driver-generated ID will be a :php:`MongoDB\\BSON\\ObjectID driver-generated ID will be a :php:`MongoDB\\BSON\\ObjectId
<class.mongodb-bson-objectid>` instance. <class.mongodb-bson-objectid>` instance.
...@@ -31,7 +31,7 @@ update and replace operations in the bulk write. ...@@ -31,7 +31,7 @@ update and replace operations in the bulk write.
The index of each ID in the map corresponds to each document's position in the The index of each ID in the map corresponds to each document's position in the
bulk operation. If a document had an ID prior to upserting (i.e. the server did bulk operation. If a document had an ID prior to upserting (i.e. the server did
not generate an ID), the index will contain its ``_id`` field value. Any not generate an ID), the index will contain its ``_id`` field value. Any
server-generated ID will be a :php:`MongoDB\\BSON\\ObjectID server-generated ID will be a :php:`MongoDB\\BSON\\ObjectId
<class.mongodb-bson-objectid>` instance. <class.mongodb-bson-objectid>` instance.
Errors/Exceptions Errors/Exceptions
......
...@@ -83,7 +83,7 @@ The output would then resemble:: ...@@ -83,7 +83,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#8 (1) { object(MongoDB\BSON\ObjectId)#8 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f983" string(24) "576023c6b02fa9281da3f983"
} }
...@@ -99,7 +99,7 @@ The output would then resemble:: ...@@ -99,7 +99,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#12 (1) { object(MongoDB\BSON\ObjectId)#12 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f98d" string(24) "576023c6b02fa9281da3f98d"
} }
...@@ -115,7 +115,7 @@ The output would then resemble:: ...@@ -115,7 +115,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#10 (1) { object(MongoDB\BSON\ObjectId)#10 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f99b" string(24) "576023c6b02fa9281da3f99b"
} }
...@@ -131,7 +131,7 @@ The output would then resemble:: ...@@ -131,7 +131,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#13 (1) { object(MongoDB\BSON\ObjectId)#13 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f9a8" string(24) "576023c6b02fa9281da3f9a8"
} }
...@@ -147,7 +147,7 @@ The output would then resemble:: ...@@ -147,7 +147,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#8 (1) { object(MongoDB\BSON\ObjectId)#8 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f9b4" string(24) "576023c6b02fa9281da3f9b4"
} }
......
...@@ -56,9 +56,9 @@ Matching BSON Types in Query Criteria ...@@ -56,9 +56,9 @@ Matching BSON Types in Query Criteria
In the following example, documents in the ``restaurants`` collection use an In the following example, documents in the ``restaurants`` collection use an
:manual:`ObjectId </reference/object-id/>` for their identifier (the default) :manual:`ObjectId </reference/object-id/>` for their identifier (the default)
and documents in the ``zips`` collection use a string. Since ObjectID is a and documents in the ``zips`` collection use a string. Since ObjectId is a
special BSON type, the query criteria for selecting a restaurant must use the special BSON type, the query criteria for selecting a restaurant must use the
:php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` class. :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>` class.
.. code-block:: php .. code-block:: php
...@@ -67,7 +67,7 @@ special BSON type, the query criteria for selecting a restaurant must use the ...@@ -67,7 +67,7 @@ special BSON type, the query criteria for selecting a restaurant must use the
$zip = $database->zips->findOne(['_id' => '10036']); $zip = $database->zips->findOne(['_id' => '10036']);
$restaurant = $database->restaurants->findOne([ $restaurant = $database->restaurants->findOne([
'_id' => new MongoDB\BSON\ObjectID('594d5ef280a846852a4b3f70'), '_id' => new MongoDB\BSON\ObjectId('594d5ef280a846852a4b3f70'),
]); ]);
Projecting Fields Projecting Fields
...@@ -104,7 +104,7 @@ The output would then resemble:: ...@@ -104,7 +104,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#8 (1) { object(MongoDB\BSON\ObjectId)#8 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f983" string(24) "576023c6b02fa9281da3f983"
} }
......
...@@ -79,7 +79,7 @@ The output would then resemble:: ...@@ -79,7 +79,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#11 (1) { object(MongoDB\BSON\ObjectId)#11 (1) {
["oid"]=> ["oid"]=>
string(24) "594d5ef280a846852a4b3f70" string(24) "594d5ef280a846852a4b3f70"
} }
......
...@@ -121,7 +121,7 @@ The output would then resemble:: ...@@ -121,7 +121,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(6) { array(6) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#11 (1) { object(MongoDB\BSON\ObjectId)#11 (1) {
["oid"]=> ["oid"]=>
string(24) "594d5ef380a846852a4b5837" string(24) "594d5ef380a846852a4b5837"
} }
......
...@@ -80,7 +80,7 @@ The output would then resemble:: ...@@ -80,7 +80,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(2) { array(2) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#12 (1) { object(MongoDB\BSON\ObjectId)#12 (1) {
["oid"]=> ["oid"]=>
string(24) "594d5ef280a846852a4b3dee" string(24) "594d5ef280a846852a4b3dee"
} }
......
...@@ -84,12 +84,12 @@ The output would then resemble:: ...@@ -84,12 +84,12 @@ The output would then resemble::
Inserted 2 document(s) Inserted 2 document(s)
array(2) { array(2) {
[0]=> [0]=>
object(MongoDB\BSON\ObjectID)#11 (1) { object(MongoDB\BSON\ObjectId)#11 (1) {
["oid"]=> ["oid"]=>
string(24) "579a25921f417dd1e5518141" string(24) "579a25921f417dd1e5518141"
} }
[1]=> [1]=>
object(MongoDB\BSON\ObjectID)#12 (1) { object(MongoDB\BSON\ObjectId)#12 (1) {
["oid"]=> ["oid"]=>
string(24) "579a25921f417dd1e5518142" string(24) "579a25921f417dd1e5518142"
} }
......
...@@ -74,7 +74,7 @@ The following operation inserts a document into the ``users`` collection in the ...@@ -74,7 +74,7 @@ The following operation inserts a document into the ``users`` collection in the
The output would then resemble:: The output would then resemble::
Inserted 1 document(s) Inserted 1 document(s)
object(MongoDB\BSON\ObjectID)#11 (1) { object(MongoDB\BSON\ObjectId)#11 (1) {
["oid"]=> ["oid"]=>
string(24) "579a25921f417dd1e5518141" string(24) "579a25921f417dd1e5518141"
} }
......
...@@ -34,7 +34,7 @@ Return Values ...@@ -34,7 +34,7 @@ Return Values
The ``_id`` field of the metadata document associated with the newly created The ``_id`` field of the metadata document associated with the newly created
GridFS file. If the ``_id`` option is not specified, a new GridFS file. If the ``_id`` option is not specified, a new
:php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` object will be used :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>` object will be used
by default. by default.
Errors/Exceptions Errors/Exceptions
......
...@@ -32,5 +32,5 @@ A map of IDs (i.e. ``_id`` field values) for the inserted documents. ...@@ -32,5 +32,5 @@ A map of IDs (i.e. ``_id`` field values) for the inserted documents.
The index of each ID in the map corresponds to each document's position in the The index of each ID in the map corresponds to each document's position in the
bulk operation. If a document had an ID prior to inserting (i.e. the driver did bulk operation. If a document had an ID prior to inserting (i.e. the driver did
not generate an ID), the index will contain its ``_id`` field value. Any not generate an ID), the index will contain its ``_id`` field value. Any
driver-generated ID will be a :php:`MongoDB\\BSON\\ObjectID driver-generated ID will be a :php:`MongoDB\\BSON\\ObjectId
<class.mongodb-bson-objectid>` instance. <class.mongodb-bson-objectid>` instance.
...@@ -31,5 +31,5 @@ The ID (i.e. ``_id`` field value) of the inserted document. ...@@ -31,5 +31,5 @@ The ID (i.e. ``_id`` field value) of the inserted document.
If the document had an ID prior to inserting (i.e. the driver did not need to If the document had an ID prior to inserting (i.e. the driver did not need to
generate an ID), this will contain its ``_id`` field value. Any driver-generated generate an ID), this will contain its ``_id`` field value. Any driver-generated
ID will be a :php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` ID will be a :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>`
instance. instance.
...@@ -29,7 +29,7 @@ upserted, ``null`` will be returned. ...@@ -29,7 +29,7 @@ upserted, ``null`` will be returned.
If the document had an ID prior to upserting (i.e. the server did not need to If the document had an ID prior to upserting (i.e. the server did not need to
generate an ID), this will contain its ``_id`` field value. Any server-generated generate an ID), this will contain its ``_id`` field value. Any server-generated
ID will be a :php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` ID will be a :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>`
instance. instance.
Errors/Exceptions Errors/Exceptions
......
...@@ -74,7 +74,7 @@ The output would then resemble:: ...@@ -74,7 +74,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(3) { array(3) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#3 (1) { object(MongoDB\BSON\ObjectId)#3 (1) {
["oid"]=> ["oid"]=>
string(24) "55cba2486c522cafdb059bed" string(24) "55cba2486c522cafdb059bed"
} }
...@@ -113,7 +113,7 @@ The output would then resemble:: ...@@ -113,7 +113,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(3) { array(3) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#15 (1) { object(MongoDB\BSON\ObjectId)#15 (1) {
["oid"]=> ["oid"]=>
string(24) "55cba2476c522cafdb0544df" string(24) "55cba2476c522cafdb0544df"
} }
...@@ -152,7 +152,7 @@ The output would then resemble:: ...@@ -152,7 +152,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(3) { array(3) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#20 (1) { object(MongoDB\BSON\ObjectId)#20 (1) {
["oid"]=> ["oid"]=>
string(24) "55cba2476c522cafdb053c92" string(24) "55cba2476c522cafdb053c92"
} }
......
...@@ -145,7 +145,7 @@ The output would then resemble:: ...@@ -145,7 +145,7 @@ The output would then resemble::
``"94301"``. The same criteria would not have matched a document with an ``"94301"``. The same criteria would not have matched a document with an
integer value of ``94301`` due to MongoDB's :manual:`comparison rules for integer value of ``94301`` due to MongoDB's :manual:`comparison rules for
BSON types </reference/bson-type-comparison-order>`. Similarly, users should BSON types </reference/bson-type-comparison-order>`. Similarly, users should
use a :php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>` object use a :php:`MongoDB\\BSON\\ObjectId <class.mongodb-bson-objectid>` object
when matching an ``_id`` with an :manual:`ObjectId </reference/object-id/>` when matching an ``_id`` with an :manual:`ObjectId </reference/object-id/>`
value, as strings and ObjectIds are not directly comparable. value, as strings and ObjectIds are not directly comparable.
...@@ -237,7 +237,7 @@ The output would then resemble:: ...@@ -237,7 +237,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#8 (1) { object(MongoDB\BSON\ObjectId)#8 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f983" string(24) "576023c6b02fa9281da3f983"
} }
...@@ -253,7 +253,7 @@ The output would then resemble:: ...@@ -253,7 +253,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#12 (1) { object(MongoDB\BSON\ObjectId)#12 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f98d" string(24) "576023c6b02fa9281da3f98d"
} }
...@@ -269,7 +269,7 @@ The output would then resemble:: ...@@ -269,7 +269,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#10 (1) { object(MongoDB\BSON\ObjectId)#10 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f99b" string(24) "576023c6b02fa9281da3f99b"
} }
...@@ -285,7 +285,7 @@ The output would then resemble:: ...@@ -285,7 +285,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(4) { array(4) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#13 (1) { object(MongoDB\BSON\ObjectId)#13 (1) {
["oid"]=> ["oid"]=>
string(24) "576023c6b02fa9281da3f9a8" string(24) "576023c6b02fa9281da3f9a8"
} }
...@@ -658,7 +658,7 @@ The output would then resemble:: ...@@ -658,7 +658,7 @@ The output would then resemble::
["storage":"ArrayObject":private]=> ["storage":"ArrayObject":private]=>
array(3) { array(3) {
["_id"]=> ["_id"]=>
object(MongoDB\BSON\ObjectID)#15 (1) { object(MongoDB\BSON\ObjectId)#15 (1) {
["oid"]=> ["oid"]=>
string(24) "57509c4406d7241dad86e7c3" string(24) "57509c4406d7241dad86e7c3"
} }
......
...@@ -84,7 +84,7 @@ class BulkWriteResult ...@@ -84,7 +84,7 @@ class BulkWriteResult
* The index of each ID in the map corresponds to each document's position * The index of each ID in the map corresponds to each document's position
* in the bulk operation. If a document had an ID prior to inserting (i.e. * in the bulk operation. If a document had an ID prior to inserting (i.e.
* the driver did not generate an ID), the index will contain its "_id" * the driver did not generate an ID), the index will contain its "_id"
* field value. Any driver-generated ID will be a MongoDB\BSON\ObjectID * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId
* instance. * instance.
* *
* @return mixed[] * @return mixed[]
...@@ -157,7 +157,7 @@ class BulkWriteResult ...@@ -157,7 +157,7 @@ class BulkWriteResult
* The index of each ID in the map corresponds to each document's position * The index of each ID in the map corresponds to each document's position
* in bulk operation. If a document had an ID prior to upserting (i.e. the * in bulk operation. If a document had an ID prior to upserting (i.e. the
* server did not need to generate an ID), this will contain its "_id". Any * server did not need to generate an ID), this will contain its "_id". Any
* server-generated ID will be a MongoDB\BSON\ObjectID instance. * server-generated ID will be a MongoDB\BSON\ObjectId instance.
* *
* This method should only be called if the write was acknowledged. * This method should only be called if the write was acknowledged.
* *
......
...@@ -66,7 +66,7 @@ class InsertManyResult ...@@ -66,7 +66,7 @@ class InsertManyResult
* The index of each ID in the map corresponds to each document's position * The index of each ID in the map corresponds to each document's position
* in the bulk operation. If a document had an ID prior to inserting (i.e. * in the bulk operation. If a document had an ID prior to inserting (i.e.
* the driver did not generate an ID), the index will contain its "_id" * the driver did not generate an ID), the index will contain its "_id"
* field value. Any driver-generated ID will be a MongoDB\BSON\ObjectID * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId
* instance. * instance.
* *
* @return mixed[] * @return mixed[]
......
...@@ -65,7 +65,7 @@ class InsertOneResult ...@@ -65,7 +65,7 @@ class InsertOneResult
* *
* If the document had an ID prior to inserting (i.e. the driver did not * If the document had an ID prior to inserting (i.e. the driver did not
* need to generate an ID), this will contain its "_id". Any * need to generate an ID), this will contain its "_id". Any
* driver-generated ID will be a MongoDB\BSON\ObjectID instance. * driver-generated ID will be a MongoDB\BSON\ObjectId instance.
* *
* @return mixed * @return mixed
*/ */
......
...@@ -101,7 +101,7 @@ class UpdateResult ...@@ -101,7 +101,7 @@ class UpdateResult
* *
* If the document had an ID prior to upserting (i.e. the server did not * If the document had an ID prior to upserting (i.e. the server did not
* need to generate an ID), this will contain its "_id". Any * need to generate an ID), this will contain its "_id". Any
* server-generated ID will be a MongoDB\BSON\ObjectID instance. * server-generated ID will be a MongoDB\BSON\ObjectId instance.
* *
* This value is undefined (i.e. null) if an upsert did not take place. * This value is undefined (i.e. null) if an upsert did not take place.
* *
......
...@@ -46,7 +46,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -46,7 +46,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
// End Example 1 // End Example 1
$this->assertSame(1, $insertOneResult->getInsertedCount()); $this->assertSame(1, $insertOneResult->getInsertedCount());
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $insertOneResult->getInsertedId()); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $insertOneResult->getInsertedId());
$this->assertInventoryCount(1); $this->assertInventoryCount(1);
// Start Example 2 // Start Example 2
...@@ -85,7 +85,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -85,7 +85,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(3, $insertManyResult->getInsertedCount()); $this->assertSame(3, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(3); $this->assertInventoryCount(3);
} }
...@@ -131,7 +131,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -131,7 +131,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
...@@ -234,7 +234,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -234,7 +234,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
...@@ -314,7 +314,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -314,7 +314,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
...@@ -424,7 +424,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -424,7 +424,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
...@@ -565,7 +565,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -565,7 +565,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
...@@ -785,7 +785,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -785,7 +785,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(10, $insertManyResult->getInsertedCount()); $this->assertSame(10, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(10); $this->assertInventoryCount(10);
...@@ -897,7 +897,7 @@ class DocumentationExamplesTest extends FunctionalTestCase ...@@ -897,7 +897,7 @@ class DocumentationExamplesTest extends FunctionalTestCase
$this->assertSame(5, $insertManyResult->getInsertedCount()); $this->assertSame(5, $insertManyResult->getInsertedCount());
foreach ($insertManyResult->getInsertedIds() as $id) { foreach ($insertManyResult->getInsertedIds() as $id) {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $id); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $id);
} }
$this->assertInventoryCount(5); $this->assertInventoryCount(5);
......
...@@ -41,11 +41,11 @@ abstract class FunctionalTestCase extends TestCase ...@@ -41,11 +41,11 @@ abstract class FunctionalTestCase extends TestCase
$this->assertEquals(1, $document['ok']); $this->assertEquals(1, $document['ok']);
} }
protected function assertSameObjectID($expectedObjectID, $actualObjectID) protected function assertSameObjectId($expectedObjectId, $actualObjectId)
{ {
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $expectedObjectID); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $expectedObjectId);
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $actualObjectID); $this->assertInstanceOf('MongoDB\BSON\ObjectId', $actualObjectId);
$this->assertEquals((string) $expectedObjectID, (string) $actualObjectID); $this->assertEquals((string) $expectedObjectId, (string) $actualObjectId);
} }
protected function assertSameDocument($expectedDocument, $actualDocument) protected function assertSameDocument($expectedDocument, $actualDocument)
......
...@@ -388,7 +388,7 @@ class BucketFunctionalTest extends FunctionalTestCase ...@@ -388,7 +388,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$fileDocument = $this->bucket->getFileDocumentForStream($stream); $fileDocument = $this->bucket->getFileDocumentForStream($stream);
$this->assertSameObjectID($id, $fileDocument->_id); $this->assertSameObjectId($id, $fileDocument->_id);
$this->assertSame('filename', $fileDocument->filename); $this->assertSame('filename', $fileDocument->filename);
$this->assertSame(6, $fileDocument->length); $this->assertSame(6, $fileDocument->length);
$this->assertSameDocument($metadata, $fileDocument->metadata); $this->assertSameDocument($metadata, $fileDocument->metadata);
...@@ -435,7 +435,7 @@ class BucketFunctionalTest extends FunctionalTestCase ...@@ -435,7 +435,7 @@ class BucketFunctionalTest extends FunctionalTestCase
$id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar')); $id = $this->bucket->uploadFromStream('filename', $this->createStream('foobar'));
$stream = $this->bucket->openDownloadStream($id); $stream = $this->bucket->openDownloadStream($id);
$this->assertSameObjectID($id, $this->bucket->getFileIdForStream($stream)); $this->assertSameObjectId($id, $this->bucket->getFileIdForStream($stream));
} }
public function testGetFileIdForStreamWithWritableStream() public function testGetFileIdForStreamWithWritableStream()
......
...@@ -118,7 +118,7 @@ class SpecFunctionalTest extends FunctionalTestCase ...@@ -118,7 +118,7 @@ class SpecFunctionalTest extends FunctionalTestCase
/** /**
* Convert encoded types in the array and return the modified array. * Convert encoded types in the array and return the modified array.
* *
* Nested arrays with "$oid" and "$date" keys will be converted to ObjectID * Nested arrays with "$oid" and "$date" keys will be converted to ObjectId
* and UTCDateTime instances, respectively. Nested arrays with "$hex" keys * and UTCDateTime instances, respectively. Nested arrays with "$hex" keys
* will be converted to a string or Binary object. * will be converted to a string or Binary object.
* *
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace MongoDB\Tests\Operation; namespace MongoDB\Tests\Operation;
use MongoDB\BSON\Javascript; use MongoDB\BSON\Javascript;
use MongoDB\BSON\ObjectID; use MongoDB\BSON\ObjectId;
use MongoDB\Operation\MapReduce; use MongoDB\Operation\MapReduce;
use stdClass; use stdClass;
...@@ -104,6 +104,6 @@ class MapReduceTest extends TestCase ...@@ -104,6 +104,6 @@ class MapReduceTest extends TestCase
private function getInvalidJavascriptValues() private function getInvalidJavascriptValues()
{ {
return [123, 3.14, 'foo', true, [], new stdClass, new ObjectID]; return [123, 3.14, 'foo', true, [], new stdClass, new ObjectId];
} }
} }
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