Change configuration to use environment variables instead of globals.

This commit is contained in:
Austen McDonald
2016-05-21 13:43:36 -07:00
parent 01cc817913
commit 8251e22784
4 changed files with 40 additions and 8 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ abstract class ModelTestCase extends \PHPUnit_Extensions_Database_TestCase
{
if ($this->connection === null) {
if (self::$pdo === null) {
self::$pdo = new \PDO($GLOBALS['DB_DSN'], $GLOBALS["DB_USER"], $GLOBALS["DB_PASSWORD"]);
self::$pdo = new \PDO(getenv('DB_DSN'), getenv('DB_USER'), getenv('DB_PASSWORD'));
// Read db annotations from model files
$configuration = Setup::createAnnotationMetadataConfiguration(["src/Models"], true);
@@ -47,7 +47,7 @@ abstract class ModelTestCase extends \PHPUnit_Extensions_Database_TestCase
$schemaTool->updateSchema($metaData);
}
$this->connection = $this->createDefaultDBConnection(self::$pdo, $GLOBALS["DB_NAME"]);
$this->connection = $this->createDefaultDBConnection(self::$pdo, getenv('DB_NAME'));
}
// It is important to clear the cache of the entity manager every time a new test runs!