From e2ab53ed53798d1827988d16436c8e844d36243a Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Sun, 25 Sep 2022 11:40:56 +0100 Subject: [PATCH] Fixes symlinked namespaces --- src/Factories/TestCaseFactory.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index 0036be01..3e37d5e3 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -122,6 +122,8 @@ final class TestCaseFactory $rootPath = TestSuite::getInstance()->rootPath; $relativePath = str_replace($rootPath.DIRECTORY_SEPARATOR, '', $filename); + $relativePath = ltrim($relativePath, DIRECTORY_SEPARATOR); + $basename = basename($relativePath, '.php'); $dotPos = strpos($basename, '.'); @@ -208,7 +210,13 @@ final class TestCaseFactory eval($classCode); } catch (ParseError $caught) { - throw new RuntimeException(sprintf('Unable to create test case for test file at %s', $filename), 1, $caught); + + + throw new RuntimeException(sprintf( + "Unable to create test case for test file at %s. \n %s", + $filename, + $classCode + ), 1, $caught); } }