diff --git a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php index 3b0d926c2e..53b2cee448 100644 --- a/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Form\Tests\Resources; use PHPUnit\Framework\TestCase; -use PHPUnit\Util\Xml\Loader; +use Symfony\Component\Translation\Util\XliffUtils; class TranslationFilesTest extends TestCase { @@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - $loader = class_exists(Loader::class) - ? [new Loader(), 'loadFile'] - : ['PHPUnit\Util\XML', 'loadfile']; + $document = new \DOMDocument(); + $document->loadXML(file_get_contents($filePath)); - $loader($filePath, false, false, true); + $errors = XliffUtils::validateSchema($document); - $this->addToAssertionCount(1); + $this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message')))); } public function provideTranslationFiles() diff --git a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php index c45b5a0d36..2402b01998 100644 --- a/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Resources/TranslationFilesTest.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Security\Core\Tests\Resources; use PHPUnit\Framework\TestCase; -use PHPUnit\Util\Xml\Loader; +use Symfony\Component\Translation\Util\XliffUtils; class TranslationFilesTest extends TestCase { @@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - $loader = class_exists(Loader::class) - ? [new Loader(), 'loadFile'] - : ['PHPUnit\Util\XML', 'loadfile']; + $document = new \DOMDocument(); + $document->loadXML(file_get_contents($filePath)); - $loader($filePath, false, false, true); + $errors = XliffUtils::validateSchema($document); - $this->addToAssertionCount(1); + $this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message')))); } public function provideTranslationFiles() diff --git a/src/Symfony/Component/Security/Core/composer.json b/src/Symfony/Component/Security/Core/composer.json index e1bc4c2143..c99f3a1d41 100644 --- a/src/Symfony/Component/Security/Core/composer.json +++ b/src/Symfony/Component/Security/Core/composer.json @@ -26,6 +26,7 @@ "symfony/expression-language": "^3.4|^4.0|^5.0", "symfony/http-foundation": "^3.4|^4.0|^5.0", "symfony/ldap": "^4.4|^5.0", + "symfony/translation": "^4.4|^5.0", "symfony/validator": "^3.4.31|^4.3.4|^5.0", "psr/log": "~1.0" }, diff --git a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php index 9779f43727..894ae55f10 100644 --- a/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php +++ b/src/Symfony/Component/Validator/Tests/Resources/TranslationFilesTest.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Validator\Tests\Resources; use PHPUnit\Framework\TestCase; -use PHPUnit\Util\Xml\Loader; +use Symfony\Component\Translation\Util\XliffUtils; class TranslationFilesTest extends TestCase { @@ -21,13 +21,12 @@ class TranslationFilesTest extends TestCase */ public function testTranslationFileIsValid($filePath) { - $loader = class_exists(Loader::class) - ? [new Loader(), 'loadFile'] - : ['PHPUnit\Util\XML', 'loadfile']; + $document = new \DOMDocument(); + $document->loadXML(file_get_contents($filePath)); - $loader($filePath, false, false, true); + $errors = XliffUtils::validateSchema($document); - $this->addToAssertionCount(1); + $this->assertCount(0, $errors, sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message')))); } public function provideTranslationFiles()