Use Pimple instead of Core\Registry and add Monolog for logging
This commit is contained in:
@@ -3,19 +3,12 @@
|
||||
require __DIR__.'/../../vendor/autoload.php';
|
||||
require __DIR__.'/../../app/constants.php';
|
||||
|
||||
use Core\Loader;
|
||||
use Core\Registry;
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
abstract class Base extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
$this->registry = new Registry;
|
||||
$this->registry->db = function() { return setup_db(); };
|
||||
$this->registry->event = function() { return setup_events(); };
|
||||
|
||||
if (DB_DRIVER === 'mysql') {
|
||||
$pdo = new PDO('mysql:host='.DB_HOSTNAME, DB_USERNAME, DB_PASSWORD);
|
||||
$pdo->exec('DROP DATABASE '.DB_NAME);
|
||||
@@ -28,10 +21,14 @@ abstract class Base extends PHPUnit_Framework_TestCase
|
||||
$pdo->exec('CREATE DATABASE '.DB_NAME.' WITH OWNER '.DB_USERNAME);
|
||||
$pdo = null;
|
||||
}
|
||||
|
||||
$this->container = new Pimple\Container;
|
||||
$this->container->register(new ServiceProvider\Database);
|
||||
$this->container->register(new ServiceProvider\Event);
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
$this->registry->shared('db')->closeConnection();
|
||||
$this->container['db']->closeConnection();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user