2
2
3
3
namespace MongoDB \Tests \Collection ;
4
4
5
- use MongoDB \Tests \FixtureGenerator ;
6
-
7
5
/**
8
6
* Functional tests for the Collection class.
9
7
*/
@@ -18,34 +16,4 @@ public function testDrop()
18
16
$ this ->assertCommandSucceeded ($ commandResult );
19
17
$ this ->assertCollectionCount ($ this ->getNamespace (), 0 );
20
18
}
21
-
22
- function testInsertAndRetrieve ()
23
- {
24
- $ generator = new FixtureGenerator ();
25
-
26
- for ($ i = 0 ; $ i < 10 ; $ i ++) {
27
- $ user = $ generator ->createUser ();
28
- $ result = $ this ->collection ->insertOne ($ user );
29
- $ this ->assertInstanceOf ('MongoDB\InsertOneResult ' , $ result );
30
- $ this ->assertInstanceOf ('BSON\ObjectId ' , $ result ->getInsertedId ());
31
- $ this ->assertEquals (24 , strlen ($ result ->getInsertedId ()));
32
-
33
- $ user ["_id " ] = $ result ->getInsertedId ();
34
- $ document = $ this ->collection ->findOne (array ("_id " => $ result ->getInsertedId ()));
35
- $ this ->assertEquals ($ document , $ user , "The inserted and returned objects are the same " );
36
- }
37
-
38
- $ this ->assertEquals (10 , $ i );
39
-
40
- $ query = array ("firstName " => "Ransom " );
41
- $ count = $ this ->collection ->count ($ query );
42
- $ this ->assertEquals (1 , $ count );
43
- $ cursor = $ this ->collection ->find ($ query );
44
- $ this ->assertInstanceOf ('MongoDB\Driver\Cursor ' , $ cursor );
45
-
46
- foreach ($ cursor as $ n => $ person ) {
47
- $ this ->assertInternalType ("array " , $ person );
48
- }
49
- $ this ->assertEquals (0 , $ n );
50
- }
51
19
}
0 commit comments