From 319d217a3ee9f82b14d27e8a5eab89b7f5ed06f2 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 4 Apr 2017 10:31:30 -0600 Subject: [PATCH] Some test adjustments to make things a little smoother, and prepare for some widget tests --- api/src/Accounts.php | 5 ++++- api/src/Etemplate/Widget.php | 7 ++++++- api/src/test/LoggedInTest.php | 6 +++++- doc/phpunit.xml | 1 + doc/phpunit_bootstrap.php | 20 ++++++++++++++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 doc/phpunit_bootstrap.php diff --git a/api/src/Accounts.php b/api/src/Accounts.php index 2a3f3ed3f7..6710c5d0e4 100644 --- a/api/src/Accounts.php +++ b/api/src/Accounts.php @@ -1257,6 +1257,9 @@ class Accounts } public function __destruct() { - self::$_instance = NULL; + if (self::$_instance === $this) + { + self::$_instance = NULL; + } } } diff --git a/api/src/Etemplate/Widget.php b/api/src/Etemplate/Widget.php index ccefafe10c..f9ba0dd6c8 100644 --- a/api/src/Etemplate/Widget.php +++ b/api/src/Etemplate/Widget.php @@ -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"); diff --git a/api/src/test/LoggedInTest.php b/api/src/test/LoggedInTest.php index b6e5e5c46c..a9d57c38c5 100644 --- a/api/src/test/LoggedInTest.php +++ b/api/src/test/LoggedInTest.php @@ -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) { diff --git a/doc/phpunit.xml b/doc/phpunit.xml index f018020893..5516d4f525 100644 --- a/doc/phpunit.xml +++ b/doc/phpunit.xml @@ -3,6 +3,7 @@ diff --git a/doc/phpunit_bootstrap.php b/doc/phpunit_bootstrap.php new file mode 100644 index 0000000000..77000cfb0f --- /dev/null +++ b/doc/phpunit_bootstrap.php @@ -0,0 +1,20 @@ +