Add TEST_PATH for out of source tests

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2023-01-28 09:13:52 +01:00
parent 826ca21e78
commit 7ec4ea0e66
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
4 changed files with 13 additions and 5 deletions

View File

@ -8,6 +8,14 @@ if (! defined('ROOT_PATH')) {
// phpcs:enable
}
if (! defined('TEST_PATH')) {
// This is used at Debian because tests
// can be in a different place than the source code
// phpcs:disable PSR1.Files.SideEffects
define('TEST_PATH', ROOT_PATH);
// phpcs:enable
}
/**
* Set precision to sane value, with higher values
* things behave slightly unexpectedly, for example

View File

@ -923,11 +923,11 @@ class ConfigTest extends AbstractTestCase
{
return [
[
ROOT_PATH . 'test/test_data/config.inc.php',
TEST_PATH . 'test/test_data/config.inc.php',
true,
],
[
ROOT_PATH . 'test/test_data/config-nonexisting.inc.php',
TEST_PATH . 'test/test_data/config-nonexisting.inc.php',
false,
],
];

View File

@ -28,7 +28,7 @@ class FileListingTest extends AbstractTestCase
{
$this->assertFalse($this->fileListing->getDirContent('nonexistent directory'));
$fixturesDir = ROOT_PATH . 'test/classes/_data/file_listing';
$fixturesDir = TEST_PATH . 'test/classes/_data/file_listing';
$dirContent = $this->fileListing->getDirContent($fixturesDir);
if (is_bool($dirContent)) {
@ -46,7 +46,7 @@ class FileListingTest extends AbstractTestCase
public function testGetFileSelectOptions(): void
{
$fixturesDir = ROOT_PATH . 'test/classes/_data/file_listing';
$fixturesDir = TEST_PATH . 'test/classes/_data/file_listing';
$this->assertFalse($this->fileListing->getFileSelectOptions('nonexistent directory'));

View File

@ -80,7 +80,7 @@ class ThemeTest extends AbstractTestCase
*/
public function testCheckImgPathFull(): void
{
$this->object->setFsPath(ROOT_PATH . 'test/classes/_data/gen_version_info/');
$this->object->setFsPath(TEST_PATH . 'test/classes/_data/gen_version_info/');
$this->assertTrue($this->object->loadInfo());
$this->assertEquals('Test Theme', $this->object->getName());
$this->assertEquals('5.1', $this->object->getVersion());