Closed markusweigelt closed 1 month ago
@sebastian-meyer Thanks, I had overlooked that. I added the lines back.
Hi Sebastian and Markus. Your recent changes fail unit tests in my branch (php 7.4, typo3 v11). Any ideas?
There was 1 error:
1) Kitodo\Dlf\Tests\Unit\Validation\SaxonXslToSvrlValidatorTest::testValidation
InvalidArgumentException: Saxon JAR file not found.
/home/runner/work/kitodo-presentation/kitodo-presentation/Classes/Validation/SaxonXslToSvrlValidator.php:47
/home/runner/work/kitodo-presentation/kitodo-presentation/Tests/Unit/Validation/SaxonXslToSvrlValidatorTest.php:67
phpvfscomposer:///home/runner/work/kitodo-presentation/kitodo-presentation/vendor/phpunit/phpunit/phpunit:106
/home/runner/work/kitodo-presentation/kitodo-presentation/vendor/bin/phpunit:118
--
There was 1 failure:
1) Kitodo\Dlf\Tests\Unit\Validation\SaxonXslToSvrlValidatorTest::testXslFileNotFound
Failed asserting that exception message 'Saxon JAR file not found.' contains 'XSL Schematron file not found.'.
phpvfscomposer:///home/runner/work/kitodo-presentation/kitodo-presentation/vendor/phpunit/phpunit/phpunit:106
/home/runner/work/kitodo-presentation/kitodo-presentation/vendor/bin/phpunit:118
@thomaslow The problem seem to be the Typo3 function GeneralUtility::getFileAbsFileName
https://github.com/thomaslow/kitodo-presentation/blob/6363217ab3c7c0a1863e45dfe75de2ebe16b7949/Classes/Validation/SaxonXslToSvrlValidator.php#L43, cause with extension path EXT:dlf/Tests/Fixtures/Format/alto.xml
parameter the resolved path is not returned when running with the updated typo3/testing-framework
. The behavior of resolving extension paths may have changed in the new version.
@thomaslow i run the tests again with typo3/testing-framework
6.16.9
, which succeeds, and with 7.1.0
I can reproduce the problem. I'll take a look at it tomorrow when I get a chance.
@markusweigelt I followed the empty string of GeneralUtility::getFileAbsFileName
to the Typo3 PackageManager->getActivePackages(). It seems the package key EXT:dlf
can not be resolved, because the package is not known at all when running the unit test.
The difference between testing-framework
v6 and v7 seems to be in the UnitTestsBootstrap.php. They set composerMode = true
, which prevents the PackageManager from scanning for extensions. Removing this check for composer mode loads all package paths including dlf
and the unit test works.
I'm not sure how to fix this. I see two options:
GeneralUtility::getFileAbsFileName
with an extension key in unit tests, e.g., specify only absolute file pathsWe copied Build/Test/runTests.sh
a while ago from TYPO3, maybe we need to update this script in order to correctly run the tests in composerMode
? The script seems really old anyways, referencing a lot of outdated versions (i. e. for MySQL) and missing current versions (like PHP 8.3).
I opened a new issue in order to discuss this further: #1348
This PR provides abstract classes to derived from for custom validation and reusable implementations for validation of DOMDocument.
AbstractValidator
of Extbase)DOMDocumentValidationStack
,XMLSchemesValidator
andSaxonXslToSvrlValidator
DOMDocumentValidation
middleware via TypoScript settingdomDocumentValidationValidators
Example of middleware
URI Query:
dlf/domDocumentValidation&url=https%3A%2F%2Fwww.example.com%2Fmetsmods.xml
JSON response