Some test adjustments to make things a little smoother, and prepare for some widget tests

This commit is contained in:
nathangray 2017-04-04 10:31:30 -06:00
parent da5cf61542
commit 319d217a3e
5 changed files with 36 additions and 3 deletions

View File

@ -1257,6 +1257,9 @@ class Accounts
}
public function __destruct() {
self::$_instance = NULL;
if (self::$_instance === $this)
{
self::$_instance = NULL;
}
}
}

View File

@ -143,6 +143,7 @@ class Widget
{
throw new Api\Exception\WrongParameter("Can't parse xml:\n$xml");
}
$reader->read();
}
return $reader;
}
@ -309,6 +310,10 @@ class Widget
{
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__.'/Widget')) as $path)
{
if(strpos($path, 'test/') !== FALSE)
{
continue;
}
if(substr($path, -4) == '.php')
{
try
@ -411,7 +416,7 @@ class Widget
if(!$xml)
{
if (empty($type)) $type = 'widget';
$xml = "<$type id='$id'/>";
$xml = "<$type id=\"$id\"/>";
}
//error_log(__METHOD__."('$type', ..., '$id') using $class_name");

View File

@ -85,9 +85,13 @@ abstract class LoggedInTest extends TestCase
$GLOBALS['egw']->session->kp3
);
}
if($GLOBALS['egw']->acl)
{
$GLOBALS['egw']->acl = null;
}
if($GLOBALS['egw']->accounts)
{
$GLOBALS['egw']->accounts->backend = null;
$GLOBALS['egw']->accounts = null;
}
if($GLOBALS['egw']->applications)
{

View File

@ -3,6 +3,7 @@
<phpunit
colors="true"
backupGlobals="false"
bootstrap="phpunit_bootstrap.php"
>
<php>
<var name="EGW_DOMAIN" value="default" />

20
doc/phpunit_bootstrap.php Normal file
View File

@ -0,0 +1,20 @@
<?php
/**
* Run before PHPUnit starts - common stuff for _all_ tests, like getting
* the autoloader.
* This file is automatically run once before starting.
*
* @link http://www.egroupware.org
* @author Nathan Gray
* @package
* @copyright (c) 2017 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/
// autoloader & check_load_extension
require_once realpath(__DIR__.'/../api/src/loader/common.php');
// Needed to let Cache work
$GLOBALS['egw_info']['server']['temp_dir'] = '/tmp';
$GLOBALS['egw_info']['server']['install_id'] = 'PHPUnit test';