Fix tests broken by missing fix to Anime Collection Model

This commit is contained in:
Timothy Warren 2015-10-21 15:46:50 -04:00
parent 4ad6178bf0
commit fdd0da8d93

View File

@ -34,7 +34,15 @@ class AnimeCollection extends DB {
{ {
parent::__construct($container); parent::__construct($container);
$this->db = \Query($this->db_config['collection']); try
{
$this->db = \Query($this->db_config['collection']);
}
catch (\PDOException $e)
{
$this->valid_database = FALSE;
return FALSE;
}
$this->anime_model = new AnimeModel($container); $this->anime_model = new AnimeModel($container);
// Is database valid? If not, set a flag so the // Is database valid? If not, set a flag so the
@ -42,15 +50,8 @@ class AnimeCollection extends DB {
$db_file_name = $this->db_config['collection']['file']; $db_file_name = $this->db_config['collection']['file'];
if ($db_file_name !== ':memory:') if ($db_file_name !== ':memory:')
{ {
if ( ! file_exists($db_file_name)) $db_file = @file_get_contents($db_file_name);
{ $this->valid_database = (strpos($db_file, 'SQLite format 3') === 0);
$this->valid_database = FALSE;
}
else
{
$db_file = file_get_contents($db_file_name);
$this->valid_database = (strpos($db_file, 'SQLite format 3') === 0);
}
} }
else else
{ {