From 237d81ce361ab8dc5d9cf1d914ab9e35ff6c7302 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 18 Oct 2017 15:43:35 +0200 Subject: [PATCH] Move tests into app/tests subdirectory (not app/inc/test or app/test) --- api/src/Db/{test => tests}/SchemaTest.php | 2 +- .../Etemplate/Widget/{test => tests}/DateTest.php | 2 +- .../Etemplate/Widget/{test => tests}/FloatTest.php | 4 ++-- .../Widget/{test => tests}/IntegerTest.php | 4 ++-- .../Etemplate/Widget/{test => tests}/SelectTest.php | 6 +++--- .../Widget/{test => tests}/TemplateTest.php | 4 ++-- .../Widget/{test => tests}/TextboxTest.php | 8 ++++---- .../Widget/{test => tests}/UrlEmailTest.php | 2 +- .../Etemplate/Widget/{test => tests}/UrlTest.php | 4 ++-- .../Etemplate/{test => tests}/WidgetBaseTest.php | 8 ++++---- api/src/Etemplate/{test => tests}/WidgetTest.php | 0 api/{src/test => tests}/AppTest.php | 0 api/{src/test => tests}/CacheTest.php | 2 -- api/{src/test => tests}/DateTimeTest.php | 2 -- api/{src/test => tests}/EtemplateTest.php | 2 +- api/{src/test => tests}/IncludeMgrTest.php | 2 -- api/{src/test => tests}/LoggedInTest.php | 6 ++---- api/{src/test => tests}/Test classes.odg | Bin api/{src/test => tests}/Test classes.pdf | Bin calendar/{test => tests}/TimezoneTest.php | 2 +- doc/phpunit.xml | 12 ++++-------- infolog/{test => tests}/ContactTest.php | 2 +- infolog/{test => tests}/SetProjectManagerTest.php | 2 +- infolog/{test => tests}/StatusTest.php | 2 +- infolog/{test => tests}/status_map.json | 0 25 files changed, 33 insertions(+), 45 deletions(-) rename api/src/Db/{test => tests}/SchemaTest.php (96%) rename api/src/Etemplate/Widget/{test => tests}/DateTest.php (99%) rename api/src/Etemplate/Widget/{test => tests}/FloatTest.php (97%) rename api/src/Etemplate/Widget/{test => tests}/IntegerTest.php (97%) rename api/src/Etemplate/Widget/{test => tests}/SelectTest.php (98%) rename api/src/Etemplate/Widget/{test => tests}/TemplateTest.php (96%) rename api/src/Etemplate/Widget/{test => tests}/TextboxTest.php (98%) rename api/src/Etemplate/Widget/{test => tests}/UrlEmailTest.php (98%) rename api/src/Etemplate/Widget/{test => tests}/UrlTest.php (98%) rename api/src/Etemplate/{test => tests}/WidgetBaseTest.php (98%) rename api/src/Etemplate/{test => tests}/WidgetTest.php (100%) rename api/{src/test => tests}/AppTest.php (100%) rename api/{src/test => tests}/CacheTest.php (98%) rename api/{src/test => tests}/DateTimeTest.php (97%) rename api/{src/test => tests}/EtemplateTest.php (98%) rename api/{src/test => tests}/IncludeMgrTest.php (90%) rename api/{src/test => tests}/LoggedInTest.php (96%) rename api/{src/test => tests}/Test classes.odg (100%) rename api/{src/test => tests}/Test classes.pdf (100%) rename calendar/{test => tests}/TimezoneTest.php (99%) rename infolog/{test => tests}/ContactTest.php (98%) rename infolog/{test => tests}/SetProjectManagerTest.php (99%) rename infolog/{test => tests}/StatusTest.php (97%) rename infolog/{test => tests}/status_map.json (100%) diff --git a/api/src/Db/test/SchemaTest.php b/api/src/Db/tests/SchemaTest.php similarity index 96% rename from api/src/Db/test/SchemaTest.php rename to api/src/Db/tests/SchemaTest.php index 622393a759..8303078ee7 100644 --- a/api/src/Db/test/SchemaTest.php +++ b/api/src/Db/tests/SchemaTest.php @@ -18,7 +18,7 @@ use EGroupware\Api\Db; use EGroupware\Api\Db\Schema; // test base providing Egw environment -require_once realpath(__DIR__.'/../../test/LoggedInTest.php'); +require_once realpath(__DIR__.'/../../../tests/LoggedInTest.php'); // For security reasons we exit by default if called via the webserver if (php_sapi_name() !== 'cli') diff --git a/api/src/Etemplate/Widget/test/DateTest.php b/api/src/Etemplate/Widget/tests/DateTest.php similarity index 99% rename from api/src/Etemplate/Widget/test/DateTest.php rename to api/src/Etemplate/Widget/tests/DateTest.php index 029d4d01a0..cce7271280 100644 --- a/api/src/Etemplate/Widget/test/DateTest.php +++ b/api/src/Etemplate/Widget/tests/DateTest.php @@ -13,7 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; use EGroupware\Api\DateTime; diff --git a/api/src/Etemplate/Widget/test/FloatTest.php b/api/src/Etemplate/Widget/tests/FloatTest.php similarity index 97% rename from api/src/Etemplate/Widget/test/FloatTest.php rename to api/src/Etemplate/Widget/tests/FloatTest.php index fa00841de7..4dc9cc45a2 100644 --- a/api/src/Etemplate/Widget/test/FloatTest.php +++ b/api/src/Etemplate/Widget/tests/FloatTest.php @@ -12,7 +12,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; @@ -172,7 +172,7 @@ class FloatTest extends \EGroupware\Api\Etemplate\WidgetBaseTest { $content = static::$mocked_exec_result; static::$mocked_exec_result = array(); - return $this->validateTest($content, + return $this->validateTest($content, $error ? array() : array('widget' => $value), $error ? array('widget' => $error) : array() ); diff --git a/api/src/Etemplate/Widget/test/IntegerTest.php b/api/src/Etemplate/Widget/tests/IntegerTest.php similarity index 97% rename from api/src/Etemplate/Widget/test/IntegerTest.php rename to api/src/Etemplate/Widget/tests/IntegerTest.php index 3844cb432a..214041d568 100644 --- a/api/src/Etemplate/Widget/test/IntegerTest.php +++ b/api/src/Etemplate/Widget/tests/IntegerTest.php @@ -12,7 +12,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; @@ -172,7 +172,7 @@ class IntegerTest extends \EGroupware\Api\Etemplate\WidgetBaseTest { $content = static::$mocked_exec_result; static::$mocked_exec_result = array(); - return $this->validateTest($content, + return $this->validateTest($content, $error ? array() : array('widget' => $value), $error ? array('widget' => $error) : array() ); diff --git a/api/src/Etemplate/Widget/test/SelectTest.php b/api/src/Etemplate/Widget/tests/SelectTest.php similarity index 98% rename from api/src/Etemplate/Widget/test/SelectTest.php rename to api/src/Etemplate/Widget/tests/SelectTest.php index 076f0f1700..99d41f22cc 100644 --- a/api/src/Etemplate/Widget/test/SelectTest.php +++ b/api/src/Etemplate/Widget/tests/SelectTest.php @@ -5,14 +5,14 @@ * * @link http://www.egroupware.org * @author Nathan Gray - * @package + * @package * @copyright (c) 2017 Nathan Gray * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; @@ -52,7 +52,7 @@ class SelectTest extends \EGroupware\Api\Etemplate\WidgetBaseTest 'Ψ'=> 'ψ Psi', 'Ω'=> 'ω Omega', ); - + /** * Test the widget's basic functionality - we put data in, it comes back * unchanged. diff --git a/api/src/Etemplate/Widget/test/TemplateTest.php b/api/src/Etemplate/Widget/tests/TemplateTest.php similarity index 96% rename from api/src/Etemplate/Widget/test/TemplateTest.php rename to api/src/Etemplate/Widget/tests/TemplateTest.php index fc5d7714dc..5d0e9260de 100644 --- a/api/src/Etemplate/Widget/test/TemplateTest.php +++ b/api/src/Etemplate/Widget/tests/TemplateTest.php @@ -13,7 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); /** * Description of TemplateTest @@ -64,7 +64,7 @@ class TemplateTest extends \EGroupware\Api\Etemplate\WidgetBaseTest { static $template = 'api.nested.sub_template'; $template = Template::instance($template, 'test'); $this->assertInstanceOf('EGroupware\Api\Etemplate\Widget\Template', $template); - + // Check for the sub-child to see if the template was loaded $this->assertInstanceOf('EGroupware\Api\Etemplate\Widget', $template->getElementById('sub_child')); diff --git a/api/src/Etemplate/Widget/test/TextboxTest.php b/api/src/Etemplate/Widget/tests/TextboxTest.php similarity index 98% rename from api/src/Etemplate/Widget/test/TextboxTest.php rename to api/src/Etemplate/Widget/tests/TextboxTest.php index 62d981bf88..a55b930dfa 100644 --- a/api/src/Etemplate/Widget/test/TextboxTest.php +++ b/api/src/Etemplate/Widget/tests/TextboxTest.php @@ -13,7 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; @@ -21,7 +21,7 @@ class TextboxTest extends \EGroupware\Api\Etemplate\WidgetBaseTest { const TEST_TEMPLATE = 'api.textbox_test'; - + /** * Test the widget's basic functionallity - we put data in, it comes back * unchanged. @@ -131,7 +131,7 @@ class TextboxTest extends \EGroupware\Api\Etemplate\WidgetBaseTest 'widget_readonly' => 'World' ); $result = $this->mockedExec($etemplate, $content, array(), array(), array()); - + // Only lowercase $etemplate->getElementById('widget')->attrs['validator'] = '/^[a-z]*$/'; @@ -154,7 +154,7 @@ class TextboxTest extends \EGroupware\Api\Etemplate\WidgetBaseTest $content = static::$mocked_exec_result; static::$mocked_exec_result = array(); - + return $this->validateTest($content, $error ? array() : array('widget' => $value), $error ? array('widget' => $error) : array()); } diff --git a/api/src/Etemplate/Widget/test/UrlEmailTest.php b/api/src/Etemplate/Widget/tests/UrlEmailTest.php similarity index 98% rename from api/src/Etemplate/Widget/test/UrlEmailTest.php rename to api/src/Etemplate/Widget/tests/UrlEmailTest.php index 8e2962565e..8286ba4d28 100644 --- a/api/src/Etemplate/Widget/test/UrlEmailTest.php +++ b/api/src/Etemplate/Widget/tests/UrlEmailTest.php @@ -13,7 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; diff --git a/api/src/Etemplate/Widget/test/UrlTest.php b/api/src/Etemplate/Widget/tests/UrlTest.php similarity index 98% rename from api/src/Etemplate/Widget/test/UrlTest.php rename to api/src/Etemplate/Widget/tests/UrlTest.php index 2e667232f0..8ba5bca652 100644 --- a/api/src/Etemplate/Widget/test/UrlTest.php +++ b/api/src/Etemplate/Widget/tests/UrlTest.php @@ -13,7 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; -require_once realpath(__DIR__.'/../../test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../../tests/WidgetBaseTest.php'); use EGroupware\Api\Etemplate; @@ -125,7 +125,7 @@ class UrlTest extends \EGroupware\Api\Etemplate\WidgetBaseTest array('http://1337.net'), array('http://a.b-c.de'), array('http://223.255.255.254'), - * + * */ ); } diff --git a/api/src/Etemplate/test/WidgetBaseTest.php b/api/src/Etemplate/tests/WidgetBaseTest.php similarity index 98% rename from api/src/Etemplate/test/WidgetBaseTest.php rename to api/src/Etemplate/tests/WidgetBaseTest.php index 75eba5f2f5..d24d37ed75 100644 --- a/api/src/Etemplate/test/WidgetBaseTest.php +++ b/api/src/Etemplate/tests/WidgetBaseTest.php @@ -15,7 +15,7 @@ namespace EGroupware\Api\Etemplate; use Egroupware\Api\Etemplate; // test base providing Egw environment, since we need the DB -require_once realpath(__DIR__.'/../../test/LoggedInTest.php'); +require_once realpath(__DIR__.'/../../../tests/LoggedInTest.php'); // Store request in the session, file access probably won't work due to permissions \EGroupware\Api\Etemplate\Request::$request_class = 'EGroupware\Api\Etemplate\Request\Session'; @@ -92,7 +92,7 @@ abstract class WidgetBaseTest extends \EGroupware\Api\LoggedInTest { // Store & clean the request //$etemplate->destroy_request(); - + ob_end_clean(); return $result; @@ -165,7 +165,7 @@ abstract class WidgetBaseTest extends \EGroupware\Api\LoggedInTest { * against $expected_values. Optionally, it can check that validation errors * are created by particular widgets. * - * + * * @param \EGroupware\Api\Etemplate $etemplate * @param array $content * @param array $set_values @@ -210,7 +210,7 @@ abstract class WidgetBaseTest extends \EGroupware\Api\LoggedInTest { * $validation_errors actually did raise a validation error. * * Note that in most (all?) cases, a validation error will clear the value. - * + * * @param array $content * @param array $expected_values * @param array $validation_errors diff --git a/api/src/Etemplate/test/WidgetTest.php b/api/src/Etemplate/tests/WidgetTest.php similarity index 100% rename from api/src/Etemplate/test/WidgetTest.php rename to api/src/Etemplate/tests/WidgetTest.php diff --git a/api/src/test/AppTest.php b/api/tests/AppTest.php similarity index 100% rename from api/src/test/AppTest.php rename to api/tests/AppTest.php diff --git a/api/src/test/CacheTest.php b/api/tests/CacheTest.php similarity index 98% rename from api/src/test/CacheTest.php rename to api/tests/CacheTest.php index 6b2cf9591a..50c6567abe 100644 --- a/api/src/test/CacheTest.php +++ b/api/tests/CacheTest.php @@ -14,8 +14,6 @@ namespace EGroupware\Api; -require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension - use EGroupware\Api; use PHPUnit\Framework\TestCase as TestCase; use ReflectionClass; diff --git a/api/src/test/DateTimeTest.php b/api/tests/DateTimeTest.php similarity index 97% rename from api/src/test/DateTimeTest.php rename to api/tests/DateTimeTest.php index fb0ed51ffd..77b6fb50a3 100644 --- a/api/src/test/DateTimeTest.php +++ b/api/tests/DateTimeTest.php @@ -11,8 +11,6 @@ */ namespace EGroupware\Api; -require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension - use PHPUnit\Framework\TestCase as TestCase; /** diff --git a/api/src/test/EtemplateTest.php b/api/tests/EtemplateTest.php similarity index 98% rename from api/src/test/EtemplateTest.php rename to api/tests/EtemplateTest.php index 92cf2deca1..f45b32fe9a 100644 --- a/api/src/test/EtemplateTest.php +++ b/api/tests/EtemplateTest.php @@ -12,7 +12,7 @@ namespace EGroupware\Api; -require_once realpath(__DIR__.'/../Etemplate/test/WidgetBaseTest.php'); +require_once realpath(__DIR__.'/../src/Etemplate/tests/WidgetBaseTest.php'); /** * Test the main class of Etemplate diff --git a/api/src/test/IncludeMgrTest.php b/api/tests/IncludeMgrTest.php similarity index 90% rename from api/src/test/IncludeMgrTest.php rename to api/tests/IncludeMgrTest.php index ea583f5c44..553e5bc440 100644 --- a/api/src/test/IncludeMgrTest.php +++ b/api/tests/IncludeMgrTest.php @@ -13,8 +13,6 @@ namespace EGroupware\Api; -require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension - use EGroupware\Api\Framework; use PHPUnit\Framework\TestCase as TestCase; diff --git a/api/src/test/LoggedInTest.php b/api/tests/LoggedInTest.php similarity index 96% rename from api/src/test/LoggedInTest.php rename to api/tests/LoggedInTest.php index b6225034c9..6a74062592 100644 --- a/api/src/test/LoggedInTest.php +++ b/api/tests/LoggedInTest.php @@ -14,8 +14,6 @@ namespace EGroupware\Api; -require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension - use PHPUnit\Framework\TestCase as TestCase; use EGroupware\Api; @@ -136,7 +134,7 @@ abstract class LoggedInTest extends TestCase try { - include(realpath(__DIR__ . '/../../../header.inc.php')); + include(realpath(__DIR__ . '/../../header.inc.php')); } catch (Exception $e) { @@ -146,7 +144,7 @@ abstract class LoggedInTest extends TestCase return; } - require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension + require_once realpath(__DIR__.'/../src/loader/common.php'); // autoloader & check_load_extension // egw is normally created when a file is loaded using require_once if(empty($GLOBALS['egw']) || !is_a($GLOBALS['egw'], 'EGroupware\Api\Egw\Base')) diff --git a/api/src/test/Test classes.odg b/api/tests/Test classes.odg similarity index 100% rename from api/src/test/Test classes.odg rename to api/tests/Test classes.odg diff --git a/api/src/test/Test classes.pdf b/api/tests/Test classes.pdf similarity index 100% rename from api/src/test/Test classes.pdf rename to api/tests/Test classes.pdf diff --git a/calendar/test/TimezoneTest.php b/calendar/tests/TimezoneTest.php similarity index 99% rename from calendar/test/TimezoneTest.php rename to calendar/tests/TimezoneTest.php index 307fecea8a..77290bd087 100644 --- a/calendar/test/TimezoneTest.php +++ b/calendar/tests/TimezoneTest.php @@ -13,7 +13,7 @@ namespace EGroupware\calendar; -require_once realpath(__DIR__.'/../../api/src/test/AppTest.php'); // Application test base +require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base use Egroupware\Api; diff --git a/doc/phpunit.xml b/doc/phpunit.xml index 55595438bd..dc7bf53cbf 100644 --- a/doc/phpunit.xml +++ b/doc/phpunit.xml @@ -12,21 +12,17 @@ + ../api/tests ../api/src/test/ ../api/src/*/test/ - ../api/tests - ../api/src/test/EtemplateTest.php - ../api/src/Etemplate/test/ - ../api/src/Etemplate/Widget/test/ + ../api/src/tests/EtemplateTest.php + ../api/src/Etemplate/tests/ + ../api/src/Etemplate/Widget/tests/ - ../*/test/ - - ../*/src/test/ - ../*/src/*/test/ ../*/tests/ ../api diff --git a/infolog/test/ContactTest.php b/infolog/tests/ContactTest.php similarity index 98% rename from infolog/test/ContactTest.php rename to infolog/tests/ContactTest.php index dbb10e6254..91a038c378 100644 --- a/infolog/test/ContactTest.php +++ b/infolog/tests/ContactTest.php @@ -15,7 +15,7 @@ namespace EGroupware\Infolog; -require_once realpath(__DIR__.'/../../api/src/test/AppTest.php'); // Application test base +require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base use Egroupware\Api\Contacts; diff --git a/infolog/test/SetProjectManagerTest.php b/infolog/tests/SetProjectManagerTest.php similarity index 99% rename from infolog/test/SetProjectManagerTest.php rename to infolog/tests/SetProjectManagerTest.php index ca5764468e..5b3b8a609c 100644 --- a/infolog/test/SetProjectManagerTest.php +++ b/infolog/tests/SetProjectManagerTest.php @@ -3,7 +3,7 @@ namespace EGroupware\Infolog; -require_once realpath(__DIR__.'/../../api/src/test/AppTest.php'); // Application test base +require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base use Egroupware\Api; diff --git a/infolog/test/StatusTest.php b/infolog/tests/StatusTest.php similarity index 97% rename from infolog/test/StatusTest.php rename to infolog/tests/StatusTest.php index f178e1cfac..0e9a812a47 100644 --- a/infolog/test/StatusTest.php +++ b/infolog/tests/StatusTest.php @@ -20,7 +20,7 @@ namespace EGroupware\Infolog; -require_once realpath(__DIR__.'/../../api/src/test/AppTest.php'); // Application test base +require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base use Egroupware\Api; diff --git a/infolog/test/status_map.json b/infolog/tests/status_map.json similarity index 100% rename from infolog/test/status_map.json rename to infolog/tests/status_map.json