Fix tests

This commit is contained in:
Romain Neutron
2012-10-03 20:30:05 +02:00
parent 1b2d004098
commit 004216bfc6
8 changed files with 36 additions and 14 deletions

View File

@@ -24,12 +24,17 @@ class sphinxrt
protected function __construct(registry $registry)
{
$this->registry = $registry;
if(!$registry->get('GV_sphinx') || !$registry->get('GV_sphinx_rt_host') || !$registry->get('GV_sphinx_rt_port')) {
throw new \Exception('Sphinx not configured');
}
try {
$dsn = sprintf('mysql:host=%s;port=%s;', $registry->get('GV_sphinx_rt_host'), $registry->get('GV_sphinx_rt_port'));
$this->connection = @new PDO($dsn);
} catch (Exception $e) {
} catch (\Exception $e) {
self::$_failure = true;
throw new Exception('Unable to connect to sphinx rt');
throw new \Exception('Unable to connect to sphinx rt');
}
return $this;