2
2
3
3
namespace MongoDB \Tests \Operation ;
4
4
5
- use MongoDB \Driver \Server ;
6
5
use MongoDB \Operation \DropCollection ;
7
6
use MongoDB \Operation \InsertOne ;
8
7
use MongoDB \Operation \ListCollections ;
@@ -20,34 +19,30 @@ public function testDropExistingCollection()
20
19
$ operation = new DropCollection ($ this ->getDatabaseName (), $ this ->getCollectionName ());
21
20
$ operation ->execute ($ server );
22
21
23
- $ this ->assertCollectionDoesNotExist ($ server , $ this -> getDatabaseName (), $ this ->getCollectionName ());
22
+ $ this ->assertCollectionDoesNotExist ($ this ->getCollectionName ());
24
23
}
25
24
26
25
/**
27
26
* @depends testDropExistingCollection
28
27
*/
29
28
public function testDropNonexistentCollection ()
30
29
{
31
- $ server = $ this ->getPrimaryServer ();
32
-
33
- $ this ->assertCollectionDoesNotExist ($ server , $ this ->getDatabaseName (), $ this ->getCollectionName ());
30
+ $ this ->assertCollectionDoesNotExist ($ this ->getCollectionName ());
34
31
35
32
$ operation = new DropCollection ($ this ->getDatabaseName (), $ this ->getCollectionName ());
36
- $ operation ->execute ($ server );
33
+ $ operation ->execute ($ this -> getPrimaryServer () );
37
34
}
38
35
39
36
/**
40
37
* Asserts that a collection with the given name does not exist on the
41
38
* server.
42
39
*
43
- * @param Server $server
44
- * @param string $databaseName
45
40
* @param string $collectionName
46
41
*/
47
- private function assertCollectionDoesNotExist (Server $ server , $ databaseName , $ collectionName )
42
+ private function assertCollectionDoesNotExist ($ collectionName )
48
43
{
49
- $ operation = new ListCollections ($ databaseName );
50
- $ collections = $ operation ->execute ($ server );
44
+ $ operation = new ListCollections ($ this -> getDatabaseName () );
45
+ $ collections = $ operation ->execute ($ this -> getPrimaryServer () );
51
46
52
47
$ foundCollection = null ;
53
48
@@ -58,6 +53,6 @@ private function assertCollectionDoesNotExist(Server $server, $databaseName, $co
58
53
}
59
54
}
60
55
61
- $ this ->assertNull ($ foundCollection , sprintf ('Collection %s exists on the server ' , $ collectionName ));
56
+ $ this ->assertNull ($ foundCollection , sprintf ('Collection %s exists ' , $ collectionName ));
62
57
}
63
58
}
0 commit comments