function PhptTestCase::parseExternal
Throws
1 call to PhptTestCase::parseExternal()
- PhptTestCase::parse in vendor/
phpunit/ phpunit/ src/ Runner/ PhptTestCase.php
File
-
vendor/
phpunit/ phpunit/ src/ Runner/ PhptTestCase.php, line 507
Class
- PhptTestCase
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\RunnerCode
private function parseExternal(array &$sections) : void {
$allowSections = [
'FILE',
'EXPECT',
'EXPECTF',
'EXPECTREGEX',
];
$testDirectory = dirname($this->filename) . DIRECTORY_SEPARATOR;
foreach ($allowSections as $section) {
if (isset($sections[$section . '_EXTERNAL'])) {
$externalFilename = trim($sections[$section . '_EXTERNAL']);
if (!is_file($testDirectory . $externalFilename) || !is_readable($testDirectory . $externalFilename)) {
throw new PhptExternalFileCannotBeLoadedException($section, $testDirectory . $externalFilename);
}
$sections[$section] = file_get_contents($testDirectory . $externalFilename);
}
}
}