private TestCase GetTestCase(string fullPhpTestName)
        {
            // "class::method with data set #0 ('foo', ...)" -> "class::method"
            int    dataSetStrPos = fullPhpTestName.IndexOf(" with data set ");
            string phpTestName   =
                (dataSetStrPos != -1)
                ? fullPhpTestName.Substring(0, dataSetStrPos)
                : fullPhpTestName;

            string vsTestName = PhpUnitHelper.GetTestNameFromPhp(phpTestName);

            return(new TestCase(vsTestName, PhpUnitTestExecutor.ExecutorUri, _testRunContext.Source)
            {
                DisplayName = fullPhpTestName   // Preserve the original data set information if present
            });
        }
        private static void ProcessTestsXml(Pchp.Core.Context ctx, string source, string path, ITestCaseDiscoverySink discoverySink)
        {
            var testsEl = XElement.Load(path);

            foreach (var testCaseClassEl in testsEl.Descendants("testCaseClass"))
            {
                var phpClassName = testCaseClassEl.Attribute("name").Value;
                var classInfo    = ctx.GetDeclaredType(phpClassName, autoload: false);
                var filePath     = Path.GetFullPath(Path.Combine(ctx.RootPath, classInfo.RelativePath));

                // The file might not exist as PHPUnit may mistakenly select classes and methods in its own PHAR,
                // namely PHPUnit\Framework\WarningTestCase::Warning (happened with PHPUnit 7.5.9)
                var unit =
                    File.Exists(filePath)
                    ? CodeSourceUnit.ParseCode(File.ReadAllText(filePath), filePath)
                    : null;

                foreach (var testCaseMethodEl in testCaseClassEl.Descendants("testCaseMethod"))
                {
                    var methodName = testCaseMethodEl.Attribute("name").Value;

                    var testName = PhpUnitHelper.GetTestNameFromPhp(classInfo, methodName);
                    var testCase = new TestCase(testName, PhpUnitTestExecutor.ExecutorUri, source);

                    if (unit != null)
                    {
                        testCase.DisplayName  = $"{classInfo.Name}::{methodName}";
                        testCase.CodeFilePath = filePath;
                        testCase.LineNumber   = GetLineNumber(unit, phpClassName, methodName);
                    }
                    ;

                    ProcessTraits(testCase, testCaseMethodEl.Attribute("groups")?.Value);

                    discoverySink.SendTestCase(testCase);
                }
            }
        }