diff --git a/lib/Database.php b/lib/Database.php index 194465e7..840fef42 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -14,17 +14,12 @@ class Database { public $db; private $driver; - public function __construct(Db\Driver $db = null) { - // if we're fed a pre-prepared driver, use it' - if($db) { - $this->db = $db; - } else { - $this->driver = $driver = Data::$conf->dbDriver; - $this->db = new $driver(INSTALL); - $ver = $this->db->schemaVersion(); - if(!INSTALL && $ver < self::SCHEMA_VERSION) { - $this->db->schemaUpdate(self::SCHEMA_VERSION); - } + public function __construct() { + $this->driver = $driver = Data::$conf->dbDriver; + $this->db = new $driver(INSTALL); + $ver = $this->db->schemaVersion(); + if(!INSTALL && $ver < self::SCHEMA_VERSION) { + $this->db->schemaUpdate(self::SCHEMA_VERSION); } } diff --git a/tests/lib/Database.php b/tests/lib/Database.php new file mode 100644 index 00000000..432aa046 --- /dev/null +++ b/tests/lib/Database.php @@ -0,0 +1,9 @@ +db = $drv; + } +} \ No newline at end of file diff --git a/tests/lib/Database/Setup.php b/tests/lib/Database/Setup.php index d9ed531b..2d74860b 100644 --- a/tests/lib/Database/Setup.php +++ b/tests/lib/Database/Setup.php @@ -5,7 +5,7 @@ use JKingWeb\Arsse\User\Driver as UserDriver; use JKingWeb\Arsse\Data; use JKingWeb\Arsse\Conf; use JKingWeb\Arsse\User; -use JKingWeb\Arsse\Database; +use JKingWeb\Arsse\Test\Database; use Phake; trait Setup {