forked from extern/egroupware
- Some nicer messages when things go wrong
- Reset account backend after test
This commit is contained in:
parent
03fb09e199
commit
5e13b8dfda
@ -40,6 +40,8 @@ abstract class AppTest extends TestCase
|
|||||||
* Start session once before each test case
|
* Start session once before each test case
|
||||||
*/
|
*/
|
||||||
public static function setUpBeforeClass()
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// These globals pulled from the test config (phpunit.xml)
|
// These globals pulled from the test config (phpunit.xml)
|
||||||
static::load_egw($GLOBALS['EGW_USER'],$GLOBALS['EGW_PASSWORD'], $GLOBALS['EGW_DOMAIN']);
|
static::load_egw($GLOBALS['EGW_USER'],$GLOBALS['EGW_PASSWORD'], $GLOBALS['EGW_DOMAIN']);
|
||||||
@ -47,8 +49,22 @@ abstract class AppTest extends TestCase
|
|||||||
// Re-init config, since it doesn't get handled by loading Egw
|
// Re-init config, since it doesn't get handled by loading Egw
|
||||||
Api\Config::init_static();
|
Api\Config::init_static();
|
||||||
|
|
||||||
|
if($GLOBALS['egw']->db)
|
||||||
|
{
|
||||||
$GLOBALS['egw']->db->connect();
|
$GLOBALS['egw']->db->connect();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static::markTestSkipped('No $GLOBALS[egw]->db');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
static::markTestSkipped('Unable to connect to Egroupware');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End session when done - every test case gets its own session
|
* End session when done - every test case gets its own session
|
||||||
@ -64,6 +80,10 @@ abstract class AppTest extends TestCase
|
|||||||
$GLOBALS['egw']->session->kp3
|
$GLOBALS['egw']->session->kp3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if($GLOBALS['egw']->accounts)
|
||||||
|
{
|
||||||
|
$GLOBALS['egw']->accounts->backend = null;
|
||||||
|
}
|
||||||
unset($GLOBALS['egw']);
|
unset($GLOBALS['egw']);
|
||||||
}
|
}
|
||||||
unset($GLOBALS['egw_info']);
|
unset($GLOBALS['egw_info']);
|
||||||
|
Loading…
Reference in New Issue
Block a user