mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
prevent parse errors by escaping the quote used for filename property
This commit is contained in:
@ -170,7 +170,8 @@ final class TestCaseFactory
|
|||||||
}, $filename);
|
}, $filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = (string) realpath($filename);
|
$quote = '\'';
|
||||||
|
$filename = str_replace($quote, sprintf('\\%s', $quote), (string) realpath($filename));
|
||||||
$rootPath = TestSuite::getInstance()->rootPath;
|
$rootPath = TestSuite::getInstance()->rootPath;
|
||||||
$relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename);
|
$relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename);
|
||||||
$relativePath = dirname(ucfirst($relativePath)) . DIRECTORY_SEPARATOR . basename($relativePath, '.php');
|
$relativePath = dirname(ucfirst($relativePath)) . DIRECTORY_SEPARATOR . basename($relativePath, '.php');
|
||||||
@ -203,7 +204,7 @@ final class TestCaseFactory
|
|||||||
final class $className extends $baseClass implements $hasPrintableTestCaseClassFQN {
|
final class $className extends $baseClass implements $hasPrintableTestCaseClassFQN {
|
||||||
$traitsCode
|
$traitsCode
|
||||||
|
|
||||||
private static \$__filename = '$filename';
|
private static \$__filename = $quote$filename$quote;
|
||||||
}
|
}
|
||||||
");
|
");
|
||||||
} catch (ParseError $caught) {
|
} catch (ParseError $caught) {
|
||||||
|
|||||||
Reference in New Issue
Block a user