Skip to content

Commit 37edc90

Browse files
committed
Setup Database object in DatabaseFunctionalTest
1 parent f8a18a2 commit 37edc90

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/DatabaseFunctionalTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,22 @@
1010
*/
1111
class DatabaseFunctionalTest extends FunctionalTestCase
1212
{
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+
1323
public function testDrop()
1424
{
1525
$writeResult = $this->manager->executeInsert($this->getNamespace(), array('x' => 1));
1626
$this->assertEquals(1, $writeResult->getInsertedCount());
1727

18-
$database = new Database($this->manager, $this->getDatabaseName());
19-
$commandResult = $database->drop();
28+
$commandResult = $this->database->drop();
2029
$this->assertCommandSucceeded($commandResult);
2130
$this->assertCollectionCount($this->getNamespace(), 0);
2231
}
@@ -26,8 +35,7 @@ public function testDropCollection()
2635
$writeResult = $this->manager->executeInsert($this->getNamespace(), array('x' => 1));
2736
$this->assertEquals(1, $writeResult->getInsertedCount());
2837

29-
$database = new Database($this->manager, $this->getDatabaseName());
30-
$commandResult = $database->dropCollection($this->getCollectionName());
38+
$commandResult = $this->database->dropCollection($this->getCollectionName());
3139
$this->assertCommandSucceeded($commandResult);
3240
$this->assertCollectionCount($this->getNamespace(), 0);
3341
}

0 commit comments

Comments
 (0)