mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
BaseTestCase - fix getting path of file used by tests (by implementing the Miscellaneous::getProjectRootPath() method)
This commit is contained in:
@@ -12,6 +12,7 @@ use DateTime;
|
|||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
||||||
use Meritoo\Common\Type\OopVisibilityType;
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
use Meritoo\Common\Utilities\Miscellaneous;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionMethod;
|
use ReflectionMethod;
|
||||||
@@ -105,11 +106,16 @@ abstract class BaseTestCase extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function getFilePathToTests($fileName, $directoryPath = '')
|
public function getFilePathToTests($fileName, $directoryPath = '')
|
||||||
{
|
{
|
||||||
if (!empty($directoryPath)) {
|
$rootPath = Miscellaneous::getProjectRootPath();
|
||||||
$directoryPath = '/' . $directoryPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sprintf('%s/../../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath);
|
$paths = [
|
||||||
|
$rootPath,
|
||||||
|
'data/tests',
|
||||||
|
$directoryPath,
|
||||||
|
$fileName,
|
||||||
|
];
|
||||||
|
|
||||||
|
return Miscellaneous::concatenatePaths($paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user