10
10
*/
11
11
class DatabaseFunctionalTest extends FunctionalTestCase
12
12
{
13
+ private $ database ;
14
+
15
+ public function setUp ()
16
+ {
17
+ parent ::setUp ();
18
+
19
+ $ this ->database = new Database ($ this ->manager , $ this ->getDatabaseName ());
20
+ $ this ->database ->drop ();
21
+ }
22
+
13
23
public function testDrop ()
14
24
{
15
25
$ writeResult = $ this ->manager ->executeInsert ($ this ->getNamespace (), array ('x ' => 1 ));
16
26
$ this ->assertEquals (1 , $ writeResult ->getInsertedCount ());
17
27
18
- $ database = new Database ($ this ->manager , $ this ->getDatabaseName ());
19
- $ commandResult = $ database ->drop ();
28
+ $ commandResult = $ this ->database ->drop ();
20
29
$ this ->assertCommandSucceeded ($ commandResult );
21
30
$ this ->assertCollectionCount ($ this ->getNamespace (), 0 );
22
31
}
@@ -26,8 +35,7 @@ public function testDropCollection()
26
35
$ writeResult = $ this ->manager ->executeInsert ($ this ->getNamespace (), array ('x ' => 1 ));
27
36
$ this ->assertEquals (1 , $ writeResult ->getInsertedCount ());
28
37
29
- $ database = new Database ($ this ->manager , $ this ->getDatabaseName ());
30
- $ commandResult = $ database ->dropCollection ($ this ->getCollectionName ());
38
+ $ commandResult = $ this ->database ->dropCollection ($ this ->getCollectionName ());
31
39
$ this ->assertCommandSucceeded ($ commandResult );
32
40
$ this ->assertCollectionCount ($ this ->getNamespace (), 0 );
33
41
}
0 commit comments