Skip to content

Instantly share code, notes, and snippets.

@cjsaylor
Last active December 27, 2015 01:09
Show Gist options
  • Save cjsaylor/7243308 to your computer and use it in GitHub Desktop.
Save cjsaylor/7243308 to your computer and use it in GitHub Desktop.
Utilizing Mongounit's trait to allow for mongo datasources in addition to mysql datasources.
<?php
use \Zumba\PHPUnit\Extensions\Mongo\TestTrait as MongoTest;
class DatabaseTestCase extends \PHPUnit_Extensions_Database_TestCase {
use MongoTest {
MongoTest::setUp as mongoSetUp;
MongoTest::tearDown as mongoTearDown;
}
public function setUp() {
$this->mongoSetUp();
parent::setUp();
}
public function tearDown() {
$this->mongoTearDown();
parent::tearDown();
}
public function getMongoConnection() {
// Implement mongo connection here...
}
public function getMongoDataSet() {
// Implement setting up fixture data here...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment