Use Pimple instead of Core\Registry and add Monolog for logging

This commit is contained in:
Frédéric Guillot
2014-11-14 22:44:25 -05:00
parent 1487cb2763
commit b081288188
57 changed files with 549 additions and 593 deletions

View File

@@ -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();
}
}