From 3dd37ae20224a7e3220574177a9179514605053c Mon Sep 17 00:00:00 2001 From: Meritoo Date: Wed, 20 Sep 2017 21:54:07 +0200 Subject: [PATCH] BaseTestCase - fix getting path of file used by tests (by implementing the Miscellaneous::getProjectRootPath() method) --- src/Meritoo/Common/Test/Base/BaseTestCase.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Meritoo/Common/Test/Base/BaseTestCase.php b/src/Meritoo/Common/Test/Base/BaseTestCase.php index 6a92bbe..793e182 100644 --- a/src/Meritoo/Common/Test/Base/BaseTestCase.php +++ b/src/Meritoo/Common/Test/Base/BaseTestCase.php @@ -12,6 +12,7 @@ use DateTime; use Generator; use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException; use Meritoo\Common\Type\OopVisibilityType; +use Meritoo\Common\Utilities\Miscellaneous; use PHPUnit\Framework\TestCase; use ReflectionClass; use ReflectionMethod; @@ -105,11 +106,16 @@ abstract class BaseTestCase extends TestCase */ public function getFilePathToTests($fileName, $directoryPath = '') { - if (!empty($directoryPath)) { - $directoryPath = '/' . $directoryPath; - } + $rootPath = Miscellaneous::getProjectRootPath(); - return sprintf('%s/../../../../../data/tests/%s%s', __DIR__, $fileName, $directoryPath); + $paths = [ + $rootPath, + 'data/tests', + $directoryPath, + $fileName, + ]; + + return Miscellaneous::concatenatePaths($paths); } /**