Created
February 6, 2014 15:08
-
-
Save tspycher/8845944 to your computer and use it in GitHub Desktop.
Base Clase wich drops all Collections and build the them from scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace XXX\Tests\Document; | |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
abstract class AbstractTest extends WebTestCase | |
{ | |
static $container; | |
static $application; | |
protected function loadDm($manager = "default", $clear = true) { | |
$this->dm = self::$container->get('doctrine_mongodb')->getManager($manager); | |
if ($this->dm and $clear) { | |
$this->dm->getSchemaManager()->dropCollections(); | |
$this->dm->getSchemaManager()->ensureIndexes(); | |
} | |
} | |
public static function setUpBeforeClass() | |
{ | |
//start the symfony kernel | |
$kernel = static::createKernel(); | |
$kernel->boot(); | |
//get the DI container | |
self::$container = $kernel->getContainer(); | |
self::$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel); | |
self::$application->setAutoExit(false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment