Move tests into app/tests subdirectory (not app/inc/test or app/test)

This commit is contained in:
nathangray 2017-10-18 15:43:35 +02:00
parent 4d4658e711
commit 237d81ce36
25 changed files with 33 additions and 45 deletions

View File

@ -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')

View File

@ -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;

View File

@ -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()
);

View File

@ -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()
);

View File

@ -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.

View File

@ -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'));

View File

@ -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());
}

View File

@ -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;

View File

@ -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'),
*
*
*/
);
}

View File

@ -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

View File

@ -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;

View File

@ -11,8 +11,6 @@
*/
namespace EGroupware\Api;
require_once realpath(__DIR__.'/../loader/common.php'); // autoloader & check_load_extension
use PHPUnit\Framework\TestCase as TestCase;
/**

View File

@ -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

View File

@ -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;

View File

@ -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'))

View File

@ -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;

View File

@ -12,21 +12,17 @@
</php>
<testsuites>
<testsuite name="Api">
<directory>../api/tests</directory>
<directory>../api/src/test/</directory>
<directory>../api/src/*/test/</directory>
<directory>../api/tests</directory>
</testsuite>
<testsuite name="Etemplate">
<file>../api/src/test/EtemplateTest.php</file>
<directory>../api/src/Etemplate/test/</directory>
<directory>../api/src/Etemplate/Widget/test/</directory>
<file>../api/src/tests/EtemplateTest.php</file>
<directory>../api/src/Etemplate/tests/</directory>
<directory>../api/src/Etemplate/Widget/tests/</directory>
</testsuite>
<testsuite name="Apps">
<!-- Apps with test directory -->
<directory>../*/test/</directory>
<!-- Apps with namespace -->
<directory>../*/src/test/</directory>
<directory>../*/src/*/test/</directory>
<directory>../*/tests/</directory>
<exclude>../api</exclude>

View File

@ -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;

View File

@ -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;

View File

@ -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;