From b081288188bb1744c9d7bd075aa5936e0ccbb9c4 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 14 Nov 2014 22:44:25 -0500 Subject: Use Pimple instead of Core\Registry and add Monolog for logging --- tests/units/Base.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tests/units/Base.php') diff --git a/tests/units/Base.php b/tests/units/Base.php index cb56060e..27960610 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -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(); } } -- cgit v1.2.3