From 5e13b8dfda48bd70a7326ffb2ab9c17da5831729 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 11 Jan 2017 15:41:53 -0700 Subject: [PATCH] - Some nicer messages when things go wrong - Reset account backend after test --- api/src/test/AppTest.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/api/src/test/AppTest.php b/api/src/test/AppTest.php index 47dabf1d4f..6369ed5ed4 100644 --- a/api/src/test/AppTest.php +++ b/api/src/test/AppTest.php @@ -41,13 +41,29 @@ abstract class AppTest extends TestCase */ public static function setUpBeforeClass() { - // These globals pulled from the test config (phpunit.xml) - static::load_egw($GLOBALS['EGW_USER'],$GLOBALS['EGW_PASSWORD'], $GLOBALS['EGW_DOMAIN']); + try + { + // These globals pulled from the test config (phpunit.xml) + static::load_egw($GLOBALS['EGW_USER'],$GLOBALS['EGW_PASSWORD'], $GLOBALS['EGW_DOMAIN']); - // Re-init config, since it doesn't get handled by loading Egw - Api\Config::init_static(); + // Re-init config, since it doesn't get handled by loading Egw + Api\Config::init_static(); - $GLOBALS['egw']->db->connect(); + if($GLOBALS['egw']->db) + { + $GLOBALS['egw']->db->connect(); + } + else + { + static::markTestSkipped('No $GLOBALS[egw]->db'); + die(); + } + } + catch(Exception $e) + { + static::markTestSkipped('Unable to connect to Egroupware'); + die(); + } } /** @@ -64,6 +80,10 @@ abstract class AppTest extends TestCase $GLOBALS['egw']->session->kp3 ); } + if($GLOBALS['egw']->accounts) + { + $GLOBALS['egw']->accounts->backend = null; + } unset($GLOBALS['egw']); } unset($GLOBALS['egw_info']);