diff --git a/src/Zumba/PHPUnit/Extensions/Mongo/TestTrait.php b/src/Zumba/PHPUnit/Extensions/Mongo/TestTrait.php new file mode 100644 index 0000000..48a95ff --- /dev/null +++ b/src/Zumba/PHPUnit/Extensions/Mongo/TestTrait.php @@ -0,0 +1,46 @@ +markTestSkipped('The Mongo extension is not available.'); + return; + } + $this->getMongoDataSet() + ->dropAllCollections() + ->buildCollections(); + } + + /** + * Cleanup after test. + * + * @return void + */ + public function tearDown() { + $this->getMongoDataSet()->dropAllCollections(); + } + + /** + * Retrieve a mongo connection client. + * + * @return Zumba\PHPUnit\Extensions\Mongo\Client\Connector + */ + protected abstract function getMongoConnection(); + + /** + * Retrieve a dataset object. + * + * @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet + */ + protected abstract function getMongoDataSet(); + +}